I am loading a grid with a url connector, and loading data for the child grid from another datamanager.
The loading is fine and I can pull up the correct child grids and page through the contents.
My issue comes when someone clicks on the header row of the child grid and it tries to sort the child grid. When that happens it tries to use the sorting mechanism from the main grid and crashes.
Also when someone dblclicks on a child row it returns an error becuase it is trying to edit the child row data. I am happy to have no sorting or editing capabilities on the child grid but none of the options I tried seemed to make a difference. I got the basic childGrid commands off of the javascript api on the website under heirarchical data but there is no mention there about sorting/editing and how to handle it or prevent it (if its on in main table)
<div class="col-lg-12 admin-area">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title text-center">Districts</h4></div>
<div class="panel-body">
<p class="text-bold">Below are the current school districts in the system. </p>
<div id="griddists"></div>
</div>
</div>
</div>
<script type="text/javascript">
/* Setup Contacts Table and Editing */
var distdata = ej.DataManager({
url:"assets/includes/functionsAJAX.php?mode=getDistricts",
insertUrl:"assets/includes/functionsAJAX.php?mode=addDistrict",
removeUrl:"assets/includes/functionsAJAX.php?mode=delDistrict",
updateUrl:"assets/includes/functionsAJAX.php?mode=updDistrict",
adaptor: new ej.UrlAdaptor()
});
var distchild = ej.DataManager({
url:"assets/includes/functionsAJAX.php?mode=getSchDistricts",
adaptor: new ej.UrlAdaptor()
});
var distgrid = $("#griddists").ejGrid({
dataSource: distdata,
allowPaging:true,
allowResizing:true,
allowSorting:true,
allowTextWrap:true,
isResponsive: true,
enableResponsiveRow: true,
enableAltRow:true,
enableHeaderHover:true,
enableRowHover:true,
enableTouch:false,
endAdd: function(){$("#griddists").ejGrid("refreshContent");},
endEdit: function(){$("#griddists").ejGrid("refreshContent");},
columns: [
{ field: "district_id", allowEditing:false, isIdentity:true, isPrimaryKey: true, headerText: "ID", width:75 },
{ field: "district_name", headerText: 'District Name', validationRules: { required: true, minlength: 2 } },
{ field: "district_number", headerText: 'Number', validationRules: { required: false } }
],
contextMenuSettings: { enableContextMenu: true},
editSettings: {allowEditing: true, allowAdding: true, allowDeleting: true, showDeleteConfirmDialog:true},
toolbarSettings: {
showToolbar: true,
toolbarItems: [
ej.Grid.ToolBarItems.Add,
ej.Grid.ToolBarItems.Edit,
ej.Grid.ToolBarItems.Delete,
ej.Grid.ToolBarItems.Update,
ej.Grid.ToolBarItems.Cancel,
ej.Grid.ToolBarItems.Search,
ej.Grid.ToolBarItems.PrintGrid
]
},
childGrid: {
dataSource: distchild,
queryString: "district_id",
allowSorting: false,
allowPaging: true,
pageSettings:{pageSize: 5},
columns: [
{ field: "school_id", allowEditing:false, isIdentity:true, isPrimaryKey: true, headerText: 'ID', width:75},
{ field: "school_name", allowEditing:false, headerText: 'Name'},
{ field: "school_number", allowEditing:false, headerText: 'Code'}
]
}
});
</script>