How to access Nested Object Data (Data Orthogonal) Data with . and 0 notation in jQuery Datatables
How to access Nested Object Data (Data Orthogonal) Data with . and 0 notation in jQuery Datatables
shantaram_tupe
Posts: 11Questions: 1Answers: 0
I'm referring Nested object data (objects) and Orthogonal Data to display following type of Complex Data(Java Object) in datatable.
How to access Nested Object Data (Orthogonal Data) with . and 0 notation in jQuery Datatables ?
I want to display
Sr. No. | Module Name | Category | Priority | Status | Requirement | Reference |
Module Name is from parent array
While other from Nested array (i.e.srsRequirementDetails)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Maybe this discussion from yesterday will help?
https://datatables.net/forums/discussion/comment/125376
Kevin
could you point me to the answer ?
Thank you
Sorry, the thread din't help.
Are you interested in only displaying the first element of
srsRequirementDetails
for each row?If so you can do something like this:
Kevin
I already tried this, but this only display first array element, or more specific indexed array element.
But I want to display (Iterate) all nested array elements.
As far as I know there is no provision to iterate an object and create new rows, using the above example. Each row is expected to be in its own array element. Can your server script return the data this way? You could then use Row Grouping to group the "modules".
However you should be able to display array elements in one row using
columns.render
or you can use the Detailed Rows functionality if you want to hide/show the details.How do you want the details displayed, ie, one table row for all details or individual table rows for each detail?
Kevin
@Kevin I want to Display one table row for all details, but this what I'm not able to achieve using columns.render , Detailed Rows is not my case.
If not possible then I will change My server side script data return policy and then Use Row Grouping to group the "modules".
Thank you.
Here is a simple example of looping through a nested array of objects to build an output string using
columns.render
:http://live.datatables.net/kolomujo/1/edit
Hope you can adapt it to your data and output requirements.
Kevin
this is what I wanted to do. oops now again going to change script.
thanks Kevin sir.
but what about to display rest fields on separate column
I'm afraid I don't understand the question. If you have other fields you want to display, either include them in another column as you have done those, or use
columns.render
as Kevin notes above to build a string.Allan
@allan can I use row span in Datatables ?
You can't I'm afraid. DataTables does not support either rowspan or colspan in the table body.
Allan
@allan I mean to ask you like Row Grouping uses colspan, is there any trick like rowspan ?
Nope - sorry.
Thank You Sir For Giving Me Your Valuable Time
@allan sir, can I use RowGrouping for above mention Nested Object data ?
Sort of. You'd need to flatten your data source array into an array that has a single entry for each row to be shown in the DataTable.
Allan
ok, I got it