Hi All,
I been trying to add an on-click to expand a cell into a child table. But data doesn't see to get loaded.
I understand there are examples and many have already fixed this, but I still cant figure out what's wrong with my code.
Please help. Below is a code snap.
//Prepare jtable plugin
$('#MQReposTable').jtable({
title: 'The MQ Repos v0.1',
paging: true,
pageSize: 10,
sorting: true,
defaultSorting: 'APP ASC',
selecting: true, //Enable selecting
multiselect: false, //Allow multiple selecting
selectingCheckboxes: false, //Show checkboxes on first column
selectOnRowClick: true, //Enable this to only select using checkboxes
actions:
{
listAction: 'CRUDController?action=listByFilter',
createAction:'CRUDController?action=create',
updateAction: 'CRUDController?action=update',
deleteAction: 'CRUDController?action=delete'
},
toolbar:
{
items: [ {tooltip: 'Export this table to excel', icon: 'imgs/excel.png', text: 'Export to Excel', click: function (){ alert('This is yet to be implemented.'); } }]
},
fields:
{
App_ID: {key: true, create: false,edit: false,list: false},
App_ID: {title:'ID', key: true,list: true,create:true,width: '10px'},
REGION: {title:'ENV',edit: true, list: false},
APP_NAME: {title:'APPLICATION',width: '40%',edit:true},
APP_ACRONYM: {title:'Acronym',width: '30px',edit:true },
QMGR: {title:'QMGR', width: '12px',edit: true},
Primary_server:{title:'P_Server', width: '72px',edit: true},
Secondary_server:{title:'S_Server', width: '72px',edit: true},
OS_TYPE:{title:'OS',width: '12px',edit: true},
Client_Version:{title:'MQ Client Ver',width: '12px',edit: true},
APP_TECHNOLOGY:{title:'TECHNOLOGY',width: '12px',edit: true},
VERSION:{title:'VERSION',width: '12px',edit: true},
REGION:{title:'REGION',width: '12px',edit: true},
SEG_ID:{title:'Segment',width: '12px',edit: true},
Others: { title: 'More', width: '12px', sorting: false, edit: false, create: false,listClass: 'child-opener-image-column',
display: function (app) {
//Create an image that will be used to open child table
console.log(JSON.stringify(app));
var $img = $('<img class="child-opener-image" src="imgs/list_metro.png" title="Expand View" />');
//Open child table when user clicks the image
$img.click(function () {
$('#MQReposTable').jtable('openChildTable',
$img.closest('tr'),
{
title: app.record.APP_NAME + ' - Details',
actions:
{
listAction: 'CRUDController?action=getAppById' ,
deleteAction: '/Demo/DeletePhone',
updateAction: '/Demo/UpdatePhone',
createAction: 'CRUDController?action=getAppById?App_ID=' + app.record.App_ID
},
fields:
{
APP_NAME: {title:'Application Name', key: true,list: true,create:true,width: '5px', defaultValue: app.record.APP_NAME},
QMGR:{ title: 'QMGR', width: '5px',edit: true}
}
},
function (data) { //opened handler
data.childTable.jtable('load');
});
});
//Return image to show on the person row
return $img;
}
},
},
JSON for child is
{"Result":"OK","Record":{"App_ID":1,"APP_NAME":"APP1","APP_ACRONYM":"APP1","QMGR":"ABC","Primary_server":"servers1","Secondary_server":"server2","OS_TYPE":"OEL","Client_Version":9.0.0.0","APP_TECHNOLOGY":"Java","VERSION":"1.7","REGION":"ABC"}}
Kindly suggest. Though my parent table loads, I have spend days with no clue why child table not working.
Thanks in advance.