An API to bind custom row data
An API to bind custom row data
Jeach
Posts: 5Questions: 0Answers: 0
I've posted an issue we've been having here:
http://datatables.net/forums/discussion/12493/user-provided-properties-on-row-object-is-not-available-during-a-filter.#Item_1
Basically, what is requested is to allow for a user to bind custom application data to a row for later use. By providing a clean API, it would standardize how data is bound to a row, but would also later alloy the DataTables development to manipulate it freely.
So given the following example (how we currently attempt to bind data to a row):
var rowPos = mainTable.fnAddData(tableData, false);
var rowData = mainTable.fnSettings().aoData[rowPos];
rowData.ID = id;
This only works for non-filtered tables. When a row is filtered (as explained in the link above), the data that was previously bound does not match correctly.
So if an API would be provided, similar to a key/value set, such as:
var rowPos = mainTable.fnAddData(tableData, false);
var rowData = mainTable.fnSettings().aoData[rowPos];
rowData.bind('ID', myID);
rowData.bind('data1', myInt);
rowData.bind('data2', myString);
rowData.bind('data3, myObject);
And later on, another function would be available to retrieve such data bindings:
var id = rowData.getData('ID');
var ii = rowData.getData('data1');
var ss = rowData.getData('data2');
var oo = rowData.getData('data3');
With these two functions, this would allow us to control and manage our table based on such 'meta' data. By providing an API, this allows you the implementor to bind it in any which way you see feasible and could change it at a later time without breaking compatibility. Also, during a filter action, it would be possible to provide such key/value set for the current rowData elements not filtered out.
Please let me know if you need additional information.
Thank you!
http://datatables.net/forums/discussion/12493/user-provided-properties-on-row-object-is-not-available-during-a-filter.#Item_1
Basically, what is requested is to allow for a user to bind custom application data to a row for later use. By providing a clean API, it would standardize how data is bound to a row, but would also later alloy the DataTables development to manipulate it freely.
So given the following example (how we currently attempt to bind data to a row):
var rowPos = mainTable.fnAddData(tableData, false);
var rowData = mainTable.fnSettings().aoData[rowPos];
rowData.ID = id;
This only works for non-filtered tables. When a row is filtered (as explained in the link above), the data that was previously bound does not match correctly.
So if an API would be provided, similar to a key/value set, such as:
var rowPos = mainTable.fnAddData(tableData, false);
var rowData = mainTable.fnSettings().aoData[rowPos];
rowData.bind('ID', myID);
rowData.bind('data1', myInt);
rowData.bind('data2', myString);
rowData.bind('data3, myObject);
And later on, another function would be available to retrieve such data bindings:
var id = rowData.getData('ID');
var ii = rowData.getData('data1');
var ss = rowData.getData('data2');
var oo = rowData.getData('data3');
With these two functions, this would allow us to control and manage our table based on such 'meta' data. By providing an API, this allows you the implementor to bind it in any which way you see feasible and could change it at a later time without breaking compatibility. Also, during a filter action, it would be possible to provide such key/value set for the current rowData elements not filtered out.
Please let me know if you need additional information.
Thank you!
This discussion has been closed.