Assign ID to TD elements of datatable

Assign ID to TD elements of datatable

PranavPranav Posts: 1Questions: 1Answers: 0

Hi is there a was to assign ID's to TD elements of Datatable. I have the Id,s in aoColumns as below.

"aoColumns": [
{"mData": "lastName"},
{"mData": "firstName"}
]

Can i make use of them or is there a way to assign them in json response? My Json response Object is being formed as below:

obj.put("lastName", VO.getLastName()));
obj.put("firstName", VO.getFirstName()));

lastName and firstName are my Id's that i have to assign to TDs.

Thanks

Answers

  • john_ljohn_l Posts: 45Questions: 0Answers: 12

    You could try patching up the rows to include your ID's as they are created using the createdRow callback.

    An alternative would be to wrap the data for your cells into spans, and add the ID's to the spans.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    The columns.createdCell option can be used to modify the cell node, including adding IDs.

    Allan

This discussion has been closed.