Datatables with Handlebars and how to make one with detail rows
Datatables with Handlebars and how to make one with detail rows
pborregg
Posts: 59Questions: 2Answers: 0
Allan, I'm back, but oh, so close....
[code]
SV
Type
Network
Site
Host
Type
Error: Short Description
Date/Time
{{#each alertRow}}
{{getSVValue alertLevel}}
{{abbrAType alertType}}
{{#if network}}{{network}}{{else}}NA{{/if}}
{{#if site}}{{site}}{{else}}NA{{/if}}
{{#if resource}}{{resource}}{{else}}NA{{/if}}
{{#if component}}{{component}}{{else}}NA{{/if}}
{{#if shortMessage}}
{{shortMessage}}
{{else}}
No Message Available
{{/if}}
{{stripOutTimeDate alertTime}}
Server Name: {{getResNets @index "name" "nets" networkId}}
Status: {{alertLevel}}
Issue Description: {{shortMessage}}
Alert Details: {{longMessage}}
Status: {{status}}
Resource Type: {{getResNets @index "name" "res" resourceId}}
Host Name: {{getResNets @index "hostname" "res" resourceId}}
Server IP: {{getResNets @index "hostip" "res" resourceId}}
Hardware Type: {{getResNets @index "resourcetype" "res" resourceId}}
Deployed: {{getResNets @index "datedeployed" "res" resourceId}}
Network Interface
Ingress: {{getResNets @index "ingressip" "res" resourceId}}
Egress: {{getResNets @index "egressip" "res" resourceId}}
C&C: {{getResNets @index "candc" "res" resourceId}}
IPMI: {{getResNets @index "ipmi" "res" resourceId}}
Click for Comments
ALERT ID: {{id}}
<!-- UNCOMMENT out at a later date
Notes
04:52:32 - 08262013 - Entered by: Jason Admin
Jane Jones is researching the situation
-->
{{/each}}
[/code]
That's my table. NOTICE I details row.......starts there...
[code]
SV
Type
Network
Site
Host
Type
Error: Short Description
Date/Time
{{#each alertRow}}
{{getSVValue alertLevel}}
{{abbrAType alertType}}
{{#if network}}{{network}}{{else}}NA{{/if}}
{{#if site}}{{site}}{{else}}NA{{/if}}
{{#if resource}}{{resource}}{{else}}NA{{/if}}
{{#if component}}{{component}}{{else}}NA{{/if}}
{{#if shortMessage}}
{{shortMessage}}
{{else}}
No Message Available
{{/if}}
{{stripOutTimeDate alertTime}}
Server Name: {{getResNets @index "name" "nets" networkId}}
Status: {{alertLevel}}
Issue Description: {{shortMessage}}
Alert Details: {{longMessage}}
Status: {{status}}
Resource Type: {{getResNets @index "name" "res" resourceId}}
Host Name: {{getResNets @index "hostname" "res" resourceId}}
Server IP: {{getResNets @index "hostip" "res" resourceId}}
Hardware Type: {{getResNets @index "resourcetype" "res" resourceId}}
Deployed: {{getResNets @index "datedeployed" "res" resourceId}}
Network Interface
Ingress: {{getResNets @index "ingressip" "res" resourceId}}
Egress: {{getResNets @index "egressip" "res" resourceId}}
C&C: {{getResNets @index "candc" "res" resourceId}}
IPMI: {{getResNets @index "ipmi" "res" resourceId}}
Click for Comments
ALERT ID: {{id}}
<!-- UNCOMMENT out at a later date
Notes
04:52:32 - 08262013 - Entered by: Jason Admin
Jane Jones is researching the situation
-->
{{/each}}
[/code]
That's my table. NOTICE I details row.......starts there...
This discussion has been closed.
Replies
That's my table. NOTICE I details row.......starts there...
Now, what happens is that your datatables recognizes the fact that the details row exists, as a matter of fact, with 200 rows returned, only 100 ACTUAL rows contain the master data, the other 100 rows, the details, the EVEN rows, are coming through.
BUT, that's where the similarity ends.
When parsing through the rows, the DOM captures the hidden rows, but when your datatables re-renders the table, only the MASTER rows are displayed and the detail rows are eliminated. Hmmmm.
Secondly, the sort doesn't work, at all. When you click on the column header, the rows disappear, and to get them back, you need to click on the column header again.
Is there ANYTHING at all, short of rebuilding this entire project, which we just can't do, to resolve this issue?
Thanks,
Anyone, please?
[code]
oTable = $('#alertTable').dataTable({
sDom: dWithNoFR,
bDestroy: true,
//sPaginationType: "bootstrap",
sPaginationType: "full_numbers",
oLanguage: {
sLengthMenu: "_MENU_ records per page"
},
aoColumns: [
{bSortable: false, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false}
],
bJQueryUI: true, //Make FALSE if using Bootstrap for sPaginationType
bFilter: false,
iDisplayLength: 10,
bProcessing: true,
aLengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
bPaginate: true,
bSortCellsTop: true,
aaSorting: [
[1, 'desc'],
[8, 'desc']
]
});
[/code]