jQWidgets Forums

jQuery UI Widgets Forums DataTable rowindex and filter

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 9 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • rowindex and filter #80530

    arkgroup
    Participant

    I have edit button in datatable defined like this:

    columns: [
    {
    text: 'Edit', cellsAlign: 'center', align: "center", pinned: true, columnType: 'none', width: '4.5%', editable: false, sortable: false, dataField: null,
    cellsRenderer: function (row, column, value) {
    // render custom column.
    return "<button data-row='" + row + "' class='editButtons'>Edit</button>";
    }
    },

    Then I have code on this button click:

      $(".editButtons").on('click', function (event) {
         var target = $(event.target);
      // get button's value.
         var value = target.val();
     // get clicked row.
     var rowIndex = parseInt(event.target.getAttribute('data-row'));
    

    Everything works fine, until I apply filter to datatable. After filter applied, rowindex still have old value
    Is there fix for this?

    Thanks

    rowindex and filter #80566

    Peter Stoev
    Keymaster

    Hi arkgroup,

    You can look at: http://jsfiddle.net/jqwidgets/mLmkX/ in order to learn the difference between row index, and row bound index. The index passed in the cellsRenderer is the index of the row when the row is rendered. If it is 0, then this is the first rendered row and so on.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.