Hi Thomas,
Thanks for using Syncfusion products.
We have analysed the provided code snippet and found that data for child grid is not properly bound with grid. Please refer the below code snippet to retrieve data for child grid.
window.returnLineData= function(e) {
var data = ej.DataManager(this.getCurrentViewData()[e.templateDetail.index() - 1].RMALines);
e.templateDetail.find("#detailGrid").ejGrid({
. . . .
}
For your convenience , we have created sample for your requirement with your provide code snippet.
Please let us know if you have any concerns.
Regards,
Yogesh R
Hi Thomas,
As per your requirement, we have provided work around to search parent and child grid data using parent toolbar can achieved by extending our original search operation. Please refer below code of extended search operation.
[ javascript]
$.extend(ej.JsonAdaptor.prototype,
{
onSearch: function (ds, query, e) {
if (!ds || !ds.length) return ds;
if (e.fieldNames.length === 0)
{
ej.pvt.getFieldList(ds[0], e.fieldNames);
}
return ds.filter(function (obj) {
for (var j = 0; j < e.fieldNames.length; j++) {
if
(e.fieldNames[j] == "RMALines") {
var childds =
ej.pvt.getObject(e.fieldNames[j], obj);
for (key in childds[0]) {
if
(e.comparer.call(childds[0],childds[0][key], e.searchKey, e.ignoreCase))
return true;
}
} // added for workaround
if (e.comparer.call(obj, ej.pvt.getObject(e.fieldNames[j],
obj), e.searchKey, e.ignoreCase))
return true;
}
return false;
});
}
});
Also please modify the data retrieval for child grid like below . this is for accurate processing of current row data.
window.returnLineData = function (e) {
var data = this.getCurrentViewData()[$(this.getGridRows()).not(".detailrow").index(e.templateDetail.prev())].RMALines;
For your convenience, we have created below sample.
Please let us know if you have any concerns.
Regards,
Yogesh
R
Hi Thomas,
Sorry for the inconvenience caused . we are unable to reproduce the reported script issue but reported issue seems to be problem with your browser security mode. please load your needed script from local sample like below.
<script src="scripts/jquery-1.10.1.min.js"></script>
<script src="scripts/jsrender.min.js"></script>
<script src="scripts/jquery.globalize.min.js"></script>
<script src="scripts/ej.widgets.all.min.js"></script>
<link rel='nofollow' href="http://cdn.syncfusion.com/11.2/js/flat-azure/ej.widgets.all.min.css" rel="stylesheet" />
For your convenience, we have created sample with local scripts.
note: if your issue is not resolved from above solution then please check the below link.
http://stackoverflow.com/questions/6261256/script1014-invalid-character
please let us know if you have any concerns.
Regards,
Yogesh R
Hi Thomas,
please remove below code at grid initialize . this is the
cause of the exception.
$("#Grid").ejGrid({
allowPaging: true,
pageSettings: { pageSize: 10 },
dataSource: data,
allowSearching: true,
toolBar: { allowToolBar: true, toolBarItems: ["search"] },
columns: [
{ field: "caseNumber", headerText: "Return #", key: true, isIdentity: true, textAlign: ej.textAlign.Left, width: 75 },
{ field: "caseStatus", headerText: "Status", width: 95 },
{ field: "productName", headerText: "Product", width: 125 },
{ field: "reasonForReturn", headerText: "Reason For Return", textAlign: ej.textAlign.Center, width: 325 },
{ field: "contactName", headerText: "Contact" },
{ field: "caseCreatedDate", headerText: "Created Date", format: "{0:dd-MMM-yyyy}" },
{ field: "RMALines" }
],
detailTemplate: "#Gridtemplate",
detailData: "returnLineData",
actionBegin: function (args) {
if (!ej.isNullOrUndefined(args.keyValue))
this.element.find(".e-grid").ejGrid("sendSearchRequest", args.keyValue);
}
});
For your convenience, we have attached sample.
please let us know if you have any concerns.
Regards,
Yogesh R