Get editable rows data in datatables using jquery

438
March 27, 2017, at 1:19 PM

I want to get editable rows data in datatables, for example when I clicked the column, then change the data and get value in datatables.

I have used this method.

editor.on('postEdit', function () {
      debugger;
      oTable = $('#indexList').dataTable();
      var sData = oTable.fnGetData(this.s.editRow);
      console.log(sData[0]);
      alert('The cell clicked on had the value of ' + sData[0]);
 });
Answer 1

The code below will transform clicked TR element to a set of input elements with values from TD tags

$(document).on("click", ".data-table tr", function(){
   $(this).find("td").each(function(){
       var st = $(this).text;
       $(this).html ("<input type='text' value='" + str + "'>");
    })
})
Rent Charter Buses Company
READ ALSO
How can i achieve go to next month with no buttons? [on hold]

How can i achieve go to next month with no buttons? [on hold]

i would like to know how can I go to next month with fullcalendar without buttons on mobile devices? I mean to advance to the next month with a just swipe on the smartphone or tablet, thank you

285
Allow Gridstack draggable only to a specific area of the item

Allow Gridstack draggable only to a specific area of the item

I am using Gridstack js to create draggable/resizable widgets for a dashboardThe picture shows an example widget

359
Convert PUG to Javascript/JQuery

Convert PUG to Javascript/JQuery

The PUG version of the code is below

742
Change if an input text is disabled or enabled

Change if an input text is disabled or enabled

In my program the user will be alowed to change his/her name, email and username by clicking the button "edit", i already have the attribute disable on each input text, but when i put the function on the button it doesn't change the status

402