Cannot change child row's cell data

Cannot change child row's cell data

dass2808dass2808 Posts: 3Questions: 2Answers: 0

My edit button placed at last column of the table. In responsive view the edit button goes to child row of the main row. When i click the edit button it cannot change the cell's data. But in normal view it can change the cell's data. Please help me with this

           var current_row = $(this).parents('tr');//Get the current row
            if (current_row.hasClass('child')) {//Check if the current row is a child row
                current_row = current_row.prev();//If it is, then point to the row before it (its 'parent')
            }
            var tableNo = table.row(current_row).data()["FMTTABLENO"];
            var description = table.row(current_row).data()["FMTTABLENAME"];

            var descriptionCell = table.cell(current_row, 1);
            //var currentActionCell = table.cell(current_row,2).data();
            //console.log("testing: " + currentActionCell);
            // console.log(current_row.child());

            descriptionCell.data("<input type='text' id='edit-description' value='" + description + "' class='form-control form-control-sm'/>");
            var tr = $(this).parents("tr");
            //var row = table.row(tr);
            if (tr.hasClass('child')) {
                var actionCell = table.cell(tr,0);
                actionCell.data("<div class='text-center'><a href='javascript:;' class='save-edit-record'><i class='fas fa-check text-success fa-lg'></i></a> <a href='javascript:;' class='cancel-edit-record'> <i class='fas fa-times text-danger fa-lg'></i></a></div>")
            }
            else {
                var actionCell = table.cell(current_row, 2);
                actionCell.data("<div class='text-center'><a href='javascript:;' class='save-edit-record'><i class='fas fa-check text-success fa-lg'></i></a> <a href='javascript:;' class='cancel-edit-record'> <i class='fas fa-times text-danger fa-lg'></i></a></div>")

            }

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @dass2808 ,

    Is this using Editor , or your own edit? If it's your own, there's a lot of code going on there, could you create a test case or link to your page. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.