Hi Thomas,
Thanks for using Syncfusion products.
We have analyzed your issue and we are able to reproduce the reported issue in the below scenario.
1. Enable the “allowResizeToFit” property of the grid.
2. As in your video we have shown the AddEditTemplate screen dynamically in External button click event by using below code snippet in which we have assigned a new data to the screen using "new myapp.Table1Item()" .
itemTemplate1.ejButton({ text: "Click", click: function (args) { // Showing the screen AddEditTemplate myapp.showScreen("AddEditTable1Item", null, { beforeShown: function (addScreen) { var ord = new myapp.Table1Item(); addScreen.Table1Item = ord; } }); } }); |
While using the above code snippet, the method “oncollectionchange” will be invoked and in which, by default we have destroyed the grid(When grid screen created using template). Due to this reason the grid header is misaligned.
If you are using the code snippet as in the above snippet to show the “AddEditTemplate” screen then please put the grid rendering code directly in the “FirmenUebersicht_render” method instead of “oncollectionchange” method to avoid the reported issue.
Please refer the below code snippet.
myapp.Table1ItemsGridEditingTemplate.FirmenUebersicht_render = function (element, contentItem) { if (itemTemplate.hasClass('e-grid')) { itemTemplate.ejGrid('destroy'); } var first = contentItem.children[0], fieldname = []; . . . . . . . . . . . . //Rendering the Grid Control itemTemplate.ejGrid( { dataSource: dataManger, allowPaging: true, allowSorting: true, allowMultiSorting: true, allowResizing: true, allowGrouping: true, allowReordering: true, allowTextWrap: true, allowResizeToFit: true, enablePersistence: true,
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.ExcelExport, ej.Grid.ToolBarItems.WordExport, ej.Grid.ToolBarItems.PdfExport] }, columns: fieldname });
} |
Please try the above suggestion and if you are still facing the same issue ,then please share us the code snippet that you have used for showing the AddEditTemplate screen externally and the provided information will help us to analyze the issue and update you the response as early as possible.
Please let us know if you have any queries.
Regards,
Gowthami V.
myapp.FirmenUebersicht.AddFirma_Tap_execute = function (screen) { // Write code here. myapp.showScreen("AddEditFirma", null, { . . . . . . . . afterClosed: function (addEditScreen, navigationAction) { /*flag setting for preventing reset data source after saving the data*/ window.isOpen = true; var gridObj = $("#Firmenuebersicht").ejGrid('instance') gridObj.refreshContent(true); } });
myapp.FirmenUebersicht.FirmenUebersicht_render = function (element, contentItem) { // Write code here. var gridname = "Firmenuebersicht"; var editscreenname = "AddEditFirma"; var itemTemplate = $("<div></div>").attr('id', gridname); . . . . . . . . itemTemplate.appendTo($(element)); Remove the below commented code.no need to destroy the grid //if (itemTemplate.hasClass('e-grid')) { // itemTemplate.ejGrid('destroy'); //} . . . . . . . . itemTemplate.ejGrid( { dataSource: contentItem.value.data, . . . . . . . .
contentItem.value.oncollectionchange = function () { var gridObj; /*Preventing reset data source after initial rendering*/
if (window.isOpen) return;
if (itemTemplate.hasClass('e-grid')) { gridObj = itemTemplate.ejGrid('instance'); } /*Resetting the datasource and columns */
if (gridObj) { /*Public method to update columns and dataSource*/ gridObj.dataSource(contentItem.value.data); gridObj.columns(gridObj.model.columns); } |