Yet another Row id question (and suggestion)
Yet another Row id question (and suggestion)
realview
Posts: 6Questions: 0Answers: 0
I suggest that for all your server side examples you show the data that is returned by the PHP rather than rely on PHP itself. For someone not using PHP your documentation is terrible because it is so vague and incomplete in this way. Yet DataTable is great it's an incredible and unnecessary hassle without clearing up this issue. People don't need PHP they need a clear definition of the input expected. Then any tool will work. What should be a 10 second understanding becomes days of hassle for nothing. I can't even begin to guess how I would get the DT_RowsID passed back properly in the data and I don't find a simple example that makes this clear and simple is all it takes.
Also, why isn't there a aDTRowID attribute with a parameter of string for column name or number for column index? Please explain and correct this problem. Thanks!
Also, why isn't there a aDTRowID attribute with a parameter of string for column name or number for column index? Please explain and correct this problem. Thanks!
This discussion has been closed.
Replies
As you rightly note the PHP examples are just that - examples. There is a "gallery" of other scripts available here: http://datatables.net/development/server-side/ which might be of use.
[quote]realview said: Also, why isn't there a aDTRowID attribute[/quote]
Do you mean for assigning an ID to an individual cell? There is nothing stopping you from adding this functionality with fnRowCallback or a multitude of other ways, it just isn't something which is built in.
Allan
Here is an example of the JSON structure which is used on this page: http://datatables.net/release-datatables/examples/server_side/ids.html
[code]
[
{
"DT_RowId": "row_7",
"DT_RowClass": "gradeA",
"0": "Gecko",
"1": "Firefox 1.0",
"2": "Win 98+ / OSX.2+",
"3": "1.7",
"4": "A"
},
{
"DT_RowId": "row_8",
"DT_RowClass": "gradeA",
"0": "Gecko",
"1": "Firefox 1.5",
"2": "Win 98+ / OSX.2+",
"3": "1.8",
"4": "A"
}
]
[/code]
That data structure is just JSON. Any server-side language can output such a structure. That is what is consumed by DataTables. The 0, 1 etc indexes can be altered to anything you want using the mDataProp option - explained here: http://datatables.net/blog/Extended_data_source_options_with_DataTables
Allan