jQWidgets Forums
Forum Replies Created
Viewing 1 post (of 1 total)
-
Author
-
April 3, 2013 at 10:17 am in reply to: jqxGrid with nested grids that can add, delete, update jqxGrid with nested grids that can add, delete, update #18498
I have problem when I try to add some data. The problem is duplicate adding in all renedered nested grids
var initrowdetails = function (index, parentElement, gridElement, record) { var childID = record.uid.toString(); var childGrid = $($(parentElement).children()[0]); var filtergroup = new $.jqx.filter(); var filter_or_operator = 1; var filtervalue = id; var filtercondition = 'equal'; var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); // fill the orders depending on the id. var workDetailsById = []; for (var m = 0; m < workDetail.length; m++) { var result = filter.evaluate(workDetail[m]["workDetailsID"]); if (result) workDetailsById.push(workDetail[m]); } var workDetailsSource = { datafields: [ { name: 'workDetailsID' }, { name: 'expertType' }, { name: 'expertOffice' }, { name: 'expertCount' }, { name: 'tripCount' }, { name: 'tripDays' } ], id: 'expertsID', localdata: workDetailsById } if (childGrid != null) { childGrid.jqxGrid({ source: workDetailsSource, theme: theme, width: 800, height: 200, showstatusbar: true, renderstatusbar: function(statusbar){ var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); var addButton = $("<div style='float: left; margin-left: 5px;'><img style='position: relative; margin-top: 2px;' src='../../../images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>"); var deleteButton = $("<div style='float: left; margin-left: 5px;'><img style='position: relative; margin-top: 2px;' src='../../../images/close.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Delete</span></div>"); container.append(addButton); container.append(deleteButton); statusbar.append(container); addButton.jqxButton({ theme: theme, width: 60, height: 20 }); deleteButton.jqxButton({ theme: theme, width: 65, height: 20 }); addButton.click(function (event) { $("#popupEditParentWindow").jqxWindow('open'); }); $("#Save").click(function () { var row = { expertType: $("#expertType").val(), expertOffice: $("#expertOffice").val(), expertCount: parseInt($("#expertCount").jqxNumberInput('decimal')), tripCount: parseInt($("#tripCount").jqxNumberInput('decimal')), tdayCount: ($("#tdayCount").jqxNumberInput('decimal')) }; var rows = childGrid.jqxGrid('getrows'); var rowindex = $('#worksview').jqxGrid('getselectedrowindex'); childGrid.jqxGrid('addrow', null, row); $("#popupEditParentWindow").jqxWindow('hide'); }); // delete selected row. deleteButton.click(function (event) { var selectedrowindex = childGrid.jqxGrid('getselectedrowindex'); var rowscount = childGrid.jqxGrid('getdatainformation').rowscount; if (selectedrowindex >= 0 && selectedrowindex < rowscount) { var id = childGrid.jqxGrid('getrowid', selectedrowindex); childGrid.jqxGrid('deleterow', id); } }); }, columns: [ { text: 'expertType', datafield: 'expertType', width: 200 }, { text: 'expertOffice', datafield: 'expertOffice', width: 200 }, { text: 'expertCount', datafield: 'expertCount', width: 150 }, { text: 'tripDays', datafield: 'tripDays', width: 150 }, { text: 'expertType', datafield: 'tripCount', width: 200 } ] }); } }
-
AuthorPosts
Viewing 1 post (of 1 total)