jQuery UI Widgets › Forums › General Discussions › Rowexpand in nested grid
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 10 years, 8 months ago.
-
AuthorRowexpand in nested grid Posts
-
Hi
We are having 3-level nested jqxgrid.On rowexpand at every level we want to make a call to server to get refresh data .
Here is our code for nested grid . we are having difficulty in refreshing data from server on rowexpand. When we tried to make a call on subgrids it s getting redirected to main grid only .var loadMyQueryData = function() {
return myQueryVM.loadMyQueryData();
};var loadMyQueryVersionData = function(queryId){
return myQueryVM.loadMyQueryVersionData(queryId);
};
var loadMyQueryVersionVendorData = function(queryId,queryVersionId){
return myQueryVM.loadMyQueryVersionVendorData(queryId,queryVersionId);
};var init = function(gridElementObject) {
var gridElement = gridElementObject;
var theme = getTheme();
var data = new Array();
var firstNames = [ “Nancy”, “Andrew”, “Janet”, “Margaret”, “Steven”,
“Michael”, “Robert”, “Laura”, “Anne” ];
var lastNames = [ “Davolio”, “Fuller”, “Leverling”, “Peacock”,
“Buchanan”, “Suyama”, “King”, “Callahan”, “Dodsworth” ];
var titles = [ “Sales Representative”, “Vice President, Sales”,
“Sales Representative”, “Sales Representative”,
“Sales Manager”, “Sales Representative”,
“Sales Representative”, “Inside Sales Coordinator”,
“Sales Representative” ];
var titleofcourtesy = [ “Ms.”, “Dr.”, “Ms.”, “Mrs.”, “Mr.”, “Mr.”,
“Mr.”, “Ms.”, “Ms.” ];
var birthdate = [ “08-Dec-48”, “19-Feb-52”, “30-Aug-63”, “19-Sep-37”,
“04-Mar-55”, “02-Jul-63”, “29-May-60”, “09-Jan-58”, “27-Jan-66” ];
var hiredate = [ “01-May-92”, “14-Aug-92”, “01-Apr-92”, “03-May-93”,
“17-Oct-93”, “17-Oct-93”, “02-Jan-94”, “05-Mar-94”, “15-Nov-94” ];
var address = [ “507 – 20th Ave. E. Apt. 2A”, “908 W. Capital Way”,
“722 Moss Bay Blvd.”, “4110 Old Redmond Rd.”,
“14 Garrett Hill”, “Coventry House”, “Miner Rd.”,
“Edgeham Hollow”, “Winchester Way”, “4726 – 11th Ave. N.E.”,
“7 Houndstooth Rd.” ];
var city = [ “Seattle”, “Tacoma”, “Kirkland”, “Redmond”, “London”,
“London”, “London”, “Seattle”, “London” ];
var postalcode = [ “98122”, “98401”, “98033”, “98052”, “SW1 8JR”,
“EC2 7JR”, “RG1 9SP”, “98105”, “WG2 7LT” ];
var country = [ “USA”, “USA”, “USA”, “USA”, “UK”, “UK”, “UK”, “USA”,
“UK” ];
var homephone = [ “(206) 555-9857”, “(206) 555-9482”, “(206) 555-3412”,
“(206) 555-8122”, “(71) 555-4848”, “(71) 555-7773”,
“(71) 555-5598”, “(206) 555-1189”, “(71) 555-4444” ];
var notes = [
“Education includes a BA in psychology from Colorado State University in 1970. She also completed ‘The Art of the Cold Call.’ Nancy is a member of Toastmasters International.”,“Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.”,
“Janet has a BS degree in chemistry from Boston College (1984). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992.”,
“Margaret holds a BA in English literature from Concordia College (1958) and an MA from the American Institute of Culinary Arts (1966). She was assigned to the London office temporarily from July through November 1992.”,
“Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 1976. Upon joining the company as a sales representative in 1992, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London. He was promoted to sales manager in March 1993. Mr. Buchanan has completed the courses ‘Successful Telemarketing’ and ‘International Sales Management.’ He is fluent in French.”,
“Michael is a graduate of Sussex University (MA, economics, 1983) and the University of California at Los Angeles (MBA, marketing, 1986). He has also taken the courses ‘Multi-Cultural Selling’ and ‘Time Management for the Sales Professional.’ He is fluent in Japanese and can read and write French, Portuguese, and Spanish.”,
“Robert King served in the Peace Corps and traveled extensively before completing his degree in English at the University of Michigan in 1992, the year he joined the company. After completing a course entitled ‘Selling in Europe,’ he was transferred to the London office in March 1993.”,
“Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.”,
“Anne has a BA degree in English from St. Lawrence College. She is fluent in French and German.” ];
var k = 0;
for (var i = 0; i < firstNames.length; i++) {
var row = {};
row[“firstname”] = firstNames[k];
row[“lastname”] = lastNames[k];
row[“title”] = titles[k];
row[“titleofcourtesy”] = titleofcourtesy[k];
row[“birthdate”] = birthdate[k];
row[“hiredate”] = hiredate[k];
row[“address”] = address[k];
row[“city”] = city[k];
row[“postalcode”] = postalcode[k];
row[“country”] = country[k];
row[“homephone”] = homephone[k];
row[“notes”] = notes[k];
data[i] = row;
k++;
}
var source = {
localdata : data,
datatype : “array”
};
/* $(“#myQueryGrid”).bind(‘rowselect’, function (event) {});*/
var gridIndex;
var initlevel2 = function(index, parentElement, gridElement, datarecord) {var gridEle = $($(parentElement).children()[0]);
gridEle
.bind(
‘bindingcomplete’,
function(event) {
gridIndex=index;
if (event.target.id == “grid” + index) {gridEle.jqxGrid(‘beginupdate’);
var datainformation = gridEle
.jqxGrid(‘getdatainformation’);for (var i = 0; i < datainformation.rowscount; i++) {
var hidden = true;gridEle
.jqxGrid(
‘setrowdetails’,
i,
“<div id=’subgrid’ style=’margin: 10px;’></div>”,
220, hidden);
}
gridEle.jqxGrid(‘endupdate’);
}
});
if (gridEle != null) {var queryVersionItemList;
var datarow = $(“#myQueryGrid”).jqxGrid(‘getrowdata’, index);
var promise = loadMyQueryVersionData(datarow.queryId);promise.done(function (items) {
queryVersionItemList=items;
var source2 = {
localdata : queryVersionItemList,
datatype : “array”
};var dataAdapter2 = new $.jqx.dataAdapter(source2);
var dataAdapter = new $.jqx.dataAdapter(source);
gridEle.jqxGrid({
theme : theme,
source : dataAdapter2,
rowdetails : true,
initrowdetails : initlevel3,
ready : function() {
log.debug(“in ready function”);},
width : ‘100%’,
//height : ‘100%’,
autoheight :true,
columns : [ {
text : ‘Version’,
dataField : ‘queryVersionId’,
width : ‘15%’
},
{
text : ‘id’,
dataField : ‘queryId’,
width : ‘15%’
},{
text : ‘Medical Reviewer’,
dataField : ‘medicalReviewer’,
width : ‘20%’
}, {
text : ‘Medical Review’,
dataField : ‘medicalReviewStatus’,
width:’15%’
//cellsalign : ‘right’
}, {
text : ‘Financial Reviewer’,
dataField : ‘financialReviewer’,
width : ‘20%’
},
, {
text : ‘Financial Review’,
dataField : ‘financialReviewStatus’,
width : ‘15%’
},
{
text : ‘Version Created Date’,
dataField : ‘versionCreatedDate’,
width : ‘15%’
}]
});
gridEle.jqxGrid(‘hidecolumn’, ‘queryId’);});
promise.fail(function (errorMsg) {
// Send the error up to the app area.
alerter.error(‘Error Loading Items’, errorMsg);// Hide the loading screen.
EHR.loading(false);
});
}
};
/*$(‘[id^=grid]’).bind(‘rowexpand’, function(event) {
event.preventDefault();
var row = event.args.rowindex;
alert(“there”);
var datarow = $(“.versionGrid”,”#myQueryGrid”).jqxGrid(‘getrowdata’, row);
alert(“hi”+datarow.queryVersionId);
$(“.versionGrid”,”#myQueryGrid”).jqxGrid(‘updatebounddata’);
});*/
//$(“#myQueryGrid”).bind(‘rowexpand’, function(event) {
//var row = event.args.rowindex;
//var datarow = $(“#myQueryGrid”).jqxGrid(‘getrowdata’, row);
//alert(“hello”+datarow.queryId);
//$(“#myQueryGrid”).jqxGrid(‘updatebounddata’);
//});var initlevel3 = function(index) {
var subgrid=$(“#grid”+gridIndex).find(“#subgrid”+index);
//var subgrid = $($(‘#subgrid’ +index,’#grid’+gridIndex));
var grid = $($.find(‘#grid’ + gridIndex));
var queryVersionVendorItemList;
var datarow =grid.jqxGrid(‘getrowdata’, index);var promise = loadMyQueryVersionVendorData(datarow.queryId,datarow.queryVersionId);
promise.done(function (items) {
queryVersionVendorItemList=items;
var source3 = {
localdata : queryVersionVendorItemList,
datatype : “array”
};var dataAdapter3 = new $.jqx.dataAdapter(source3);
var dataAdapter = new $.jqx.dataAdapter(source);
if (subgrid != null) {
subgrid.jqxGrid({
source : dataAdapter3,
theme : theme,
width : ‘100%’,
autoheight :true,
//height : ‘100%’,
columns : [ {
text : ‘Vendor ID’,
dataField : ‘vendorId’,
width : ‘15%’
}, {
text : ‘Vendor Name’,
dataField : ‘vendorName’,
width : ‘20%’
}, {
text : ‘Vendor Log’,
dataField : ”,
width : ‘15%’
}, {
text : ‘Vendor Progress’,
dataField : ‘vendorProgress’,
width: ‘15%’
//cellsalign : ‘right’
} , {
text : ‘Vendor Cost’,
dataField : ‘vendorCost’,
width : ‘15%’
}, {
text : ‘Approved/ Rejected Date’,
dataField : ‘date’,
width : ‘20%’
}]
});
}
});
promise.fail(function (errorMsg) {
// Send the error up to the app area.
alerter.error(‘Error Loading Items’, errorMsg);// Hide the loading screen.
EHR.loading(false);
});
}
// set rows details.
$(“#myQueryGrid”)
.bind(
‘bindingcomplete’,
function(event) {if (event.target.id == “myQueryGrid”) {
$(“#myQueryGrid”).jqxGrid(‘beginupdate’);
var datainformation = $(“#myQueryGrid”)
.jqxGrid(‘getdatainformation’);
for (i = 0; i < datainformation.rowscount; i++) {
var hidden = i > 0 ? true : false;$(“#myQueryGrid”)
.jqxGrid(
‘setrowdetails’,
i,
“<div id=’grid’ class=’versionGrid’ style=’margin: 10px;’></div>”,
220, hidden);
}
$(“#myQueryGrid”).jqxGrid(‘endupdate’);
}
});
var dataAdapter = new $.jqx.dataAdapter(source);
var promise;
var queryItemList;var promise = loadMyQueryData();
promise.done(function (items) {
queryItemList=items;
var source1 = {
localdata : queryItemList,
datatype : “array”
};var dataAdapter1 = new $.jqx.dataAdapter(source1);
var records = dataAdapter.localdata;
$(“#myQueryGrid”).jqxGrid({
width : ‘100%’,theme : theme,
autoheight :true,
source : dataAdapter1,
rowdetails : true,
showfilterrow: true,filterable: true,
ready : function() {
// $(“#myQueryGrid”).jqxGrid(‘showrowdetails’, 0);
//$(“#myQueryGrid”).jqxGrid(‘showrowdetails’, 1);
},initrowdetails : initlevel2,
columns : [ {
text : ‘QueryID’,
datafield : ‘queryId’,width : ‘15%’
}, {
text : ‘Query Name’,
datafield : ‘name’,
width : ‘15%’
}, {
text : ‘Sponsor’,
datafield : ‘sponsor’,
width : ‘20%’
}, {
text : ‘Opportunity Id’,
datafield : ‘opportunityId’,
width : ‘15%’
}, {
text : ‘Study Id’,
datafield : ‘studyId’,
width : ‘15%’
} , {
text : ‘Responsible CFL’,
datafield : ‘responsible’,
width : ‘20%’
}]
});
});
promise.fail(function (errorMsg) {
// Send the error up to the app area.
alerter.error(‘Error Loading Items’, errorMsg);// Hide the loading screen.
EHR.loading(false);
});};
Hello tanukhanna,
Could you create a JSFiddle with your example, which we can test to see what the issue might be.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/I have followed this below example http://networkedblogs.com/xI0Jv
Hi tanukhanna,
Could you, please, post your complete example (including the HTML)? Remember to format it before submitting by selecting it and clicking on the
code
button in the toolbar.Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.