≡

Editor: get full data in rowCallback?

Editor: get full data in rowCallback?

elstupidelstupid Posts: 34Questions: 7Answers: 1

Is there a way to get all data from a row in the rowCallback function of the Editor?

The data for my table is retrieved using Ajax, which gives me more columns than I need to display visually. That extra data is available for the normal DataTables columnDefs render function, so I can use that data to perform specific logic in the renderer, provided through the row parameter in

render: function(data, type, row, meta) { // logic with row.undisplayedColumn etc.. }

However when using the Editor's rowCallback, only data that is visually rendered is available to that function through the data parameter:

rowCallback = function(row, data, displayNum, displayIndex, dataIndex) { // data.undisplayedColumn not available here }

If it's not easily available, would it be an idea to make it available?

Answers

  • kthorngrenkthorngren Posts: 22,526Questions: 26Answers: 5,174

    This is from the Datatables rowCallaback docs regarding the data parameter:

    This parameter is the original data source object that is used for the row.

    I built a simple test case to show that properties not displayed in the table are accessible via the data parameter:
    https://live.datatables.net/zipaxiwe/1/edit

    Please update the test case or provide a link to a test case replicating the issue.

    Kevin

  • elstupidelstupid Posts: 34Questions: 7Answers: 1

    I've been fiddling to get a working version of my situation and while doing that I found out what was wrong on my end. My backend is delivering a column in the row data only when there's a value. With a null-value it's being omitted. The first few rows didn't contain that column data, so I assumed not all row data was returned in the rowCallback.

    My bad! :#

  • allanallan Posts: 66,193Questions: 1Answers: 11,043 Site admin

    Great to hear you've found the issue - nice one tracking it down. Sometimes it is the little things that trip us all up!

    Allan

Sign In or Register to comment.