DT_RowId not adding ID to TR
DT_RowId not adding ID to TR
adrianBitsiren
Posts: 3Questions: 0Answers: 0
Hi all,
This is my second project with DataTables. Love the framework. Great job!
Currently, I'm working on my first page with editable fields. I've followed the examples to add the UID from the DB as ID to the TR tag. I have two different table templates. On one the UID is added to the TR tag on the other it isn't. I checked the returend JSON object and the DT_RowId key-value pair is definitely passed to the DT.
The only difference between the two tables is, that the second one (where the UID is not added to the TR-ID) uses sColumns to specify the order of the columns - as the data sent to the table is assembled from differing resources and needs to be display in a specific order as per client request.
Can it be, that there is a problem in the usage of sColumns and DT_RowId? I have tried adding TD_RowId at the end of array and I have also tried adding DT_RowId to the sColums list. To no avail.
[code]
sEcho 1
iTotalRecords "4792"
iTotalDisplayRecords "4792"
sColumns "id,status,tnumber,date,cxldate,difficult,prio,cur,htlso,amtso,htlcf,amtcf,ob,obsup,chop,tname,tagent,tdept,tconf,tobttl,tpax,tbs,remarkss,remarksa"
aaData [Object { DT_RowId="6964", 0="6964", 1="GA", more...}, Object { DT_RowId="6965", 0="6965", 1="GA", more...}, Object {
[/code]
Any ideas about this - safe writing the UID during/after the rendering process with a function.
Thanks for all tips and trick in advance.
a.
This is my second project with DataTables. Love the framework. Great job!
Currently, I'm working on my first page with editable fields. I've followed the examples to add the UID from the DB as ID to the TR tag. I have two different table templates. On one the UID is added to the TR tag on the other it isn't. I checked the returend JSON object and the DT_RowId key-value pair is definitely passed to the DT.
The only difference between the two tables is, that the second one (where the UID is not added to the TR-ID) uses sColumns to specify the order of the columns - as the data sent to the table is assembled from differing resources and needs to be display in a specific order as per client request.
Can it be, that there is a problem in the usage of sColumns and DT_RowId? I have tried adding TD_RowId at the end of array and I have also tried adding DT_RowId to the sColums list. To no avail.
[code]
sEcho 1
iTotalRecords "4792"
iTotalDisplayRecords "4792"
sColumns "id,status,tnumber,date,cxldate,difficult,prio,cur,htlso,amtso,htlcf,amtcf,ob,obsup,chop,tname,tagent,tdept,tconf,tobttl,tpax,tbs,remarkss,remarksa"
aaData [Object { DT_RowId="6964", 0="6964", 1="GA", more...}, Object { DT_RowId="6965", 0="6965", 1="GA", more...}, Object {
[/code]
Any ideas about this - safe writing the UID during/after the rendering process with a function.
Thanks for all tips and trick in advance.
a.
This discussion has been closed.
Replies
> uses sColumns to specify the order of the columns
That's fine in 1.9 and before, but it is deprecated in 1.9 and will be removed in 1.10 (which in fairness is a little while off!): http://datatables.net/upgrade/1.9
> DT_RowId="6964"
Is this a copy from Firebugs DOM view or something, as its not valid JSON? Also "6964" isn't a valid DOM ID - it needs to start with a letter, so you might need to prefix it - although I'd be surprised if browsers are rejecting it because of that.
If you could run the debugger over your table that would be very helpful.
Allan
Thanks for the quick answer.
I have refactored the code to use mDataProp instead of sColumns for the ordering part and that has indeed solved the problem.
Thanks.
a.
PS: Yes, DT_RowId="6964" was just a c&p from Firebug...