Hello,
I have a question.
If you set the 'frozenColumn'' on the grid that has the data, the data cannot be loaded.
You can see that the information in the dynamically generated header comes out, but not the values in the grid.
Please tell me how to solve the problem
function IndexGridDataBinding() {
var header = document.getElementById('MenuTitle');
header.innerText = headerTitle + " - PIPERACK";
var seqList = document.getElementById('SeqType').ej2_instances[0];
var seqNo = seqList.itemData;
$.ajax({
url: "/Bom/IndexHeaderBinding",
type: "POST",
data: { 'sJobNo': jobNo, 'sMenuName': 'PIPERACK' },
success: function (headerList) {
deleteHeaders = headerList;
var grid = document.getElementById('IndexGrid').ej2_instances[0];
for (var i = 0; i < headerList.length; i++) {
grid.columns.push(headerList[i]);
}
if (headerList.length > 0) {
$.ajax({
url: "/Bom/IndexDataBinding",
type: "POST",
data: { 'sJobNo': jobNo, 'sMenuName': 'PIPERACK', 'seqNo': seqNo },
success: function (gridData) {
var settingGrid = document.getElementById('IndexGrid').ej2_instances[0];
settingGrid.dataSource = ej.data.DataUtil.parse.parseJson(gridData);
settingGrid.refreshColumns();
settingGrid.refresh();
},
error: function () {
alert("Please try again in a few minutes. If the same problem repeats, contact your administrator.");
}
});
}
},
error: function () {
alert("Please try again in a few minutes. If the same problem repeats, contact your administrator.");
}
});
Hi Taewook,
Thanks for contacting Syncfusion support.
We are unable to reproduce the reported problem from our side. We suggest you to use freezeRefresh method to refresh the frozen Grid.
var initialRender = true; // use the flag variable to execute the code only once function IndexGridDataBinding() { if(initialRender){ initialRender = false; // make the flag variable false var ajax = new ej.base.Ajax({ type: "POST", url: "/Home/GetClientDeviceDocuments", contentType: "application/json; charset=utf-8", }); ajax.send(); ajax.onSuccess = function (result) { var data = JSON.parse(result); console.log(data); // example columns var headerList = [ { field: "ShipName", headerText: "Ship Name", width:140, }, { field: "ShipAddress", headerText: "Ship Address", width: 140 }, { field: "ShipCity", headerText: "Code", width: 140, }, { field: "ContractNo", headerText: "Contract No", width:140, }, { field: "EmailID", headerText: "Email ID", width: 140 }, { field: "Status", width: 140, }, ]; var grid = document.getElementById('IndexGrid').ej2_instances[0]; var gridCols = grid.columns; // store the grid columns in separate variable for (var i = 0; i < headerList.length; i++) { gridCols.push(headerList[i]); // push the new columns in the same variable } if (headerList.length > 0) { var ajax2 = new ej.base.Ajax({ type: "POST", url: "/Home/GetClientDeviceDocuments", contentType: "application/json; charset=utf-8", }); ajax2.send(); ajax2.onSuccess = function (result) { var settingGrid = document.getElementById('IndexGrid').ej2_instances[0]; // change the grid properties without refresh settingGrid.setProperties({ dataSource: ej.data.DataUtil.parse.parseJson(result), columns: gridCols }, true) // refresh the Grid settingGrid.freezeRefresh(); }; }; } } }
</script> |
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_freezeRefresh-257399463.zip
Still, if you face any issues, kindly share the Syncfusion script version you
have used.
Regards,
Rajapandiyan S
var freezeCheck = true;
function IndexGridDataBinding() {
if (freezeCheck) {
freezeCheck = false;
var header = document.getElementById('MenuTitle');
header.innerText = headerTitle + " - PIPERACK";
var seqList = document.getElementById('SeqType').ej2_instances[0];
var seqNo = seqList.itemData;
$.ajax({
url: "/Bom/IndexHeaderBinding",
type: "POST",
data: { 'sJobNo': jobNo, 'sMenuName': 'PIPERACK' },
success: function (headerList) {
deleteHeaders = headerList;
var grid = document.getElementById('IndexGrid').ej2_instances[0];
var gridCols = grid.columns;
for (var i = 0; i < headerList.length; i++) {
gridCols.push(headerList[i]);
}
if (headerList.length > 0) {
$.ajax({
url: "/Bom/IndexDataBinding",
type: "POST",
data: { 'sJobNo': jobNo, 'sMenuName': 'PIPERACK', 'seqNo': seqNo },
success: function (gridData) {
var settingGrid = document.getElementById('IndexGrid').ej2_instances[0];
settingGrid.setProperties({
dataSource: ej.data.DataUtil.parse.parseJson(gridData),
columns: gridCols
}, true)
// refresh the Grid
settingGrid.freezeRefresh();
//settingGrid.refresh();
//settingGrid.refreshColumns();
},
error: function () {
alert("Please try again in a few minutes. If the same problem repeats, contact your administrator.");
}
});
}
},
error: function () {
alert("Please try again in a few minutes. If the same problem repeats, contact your administrator.");
}
});
}
}
Thank you for your answer.
I applied it in the way you told me, but the phenomenon I said was the same.
The data is still imported well, but it is not represented on the grid.
Syncfusion Script version is 20.2.44.
Hi Taewook,
We tried to reproduce the reported problem with the mentioned version (20.2.44), but it was unsuccessful from our side. Please find the below sample for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_freezeRefresh_20_2_44_1669046128.zip
Kindly share the below details to validate further.
function actionFailure (args) { console.log(args); }
|
Regards,
Rajapandiyan S
It is difficult to bind the data remotely and put it in the sample.
There is a limit to sharing data due to the large amount of data being imported remotely.
Binding the 'actionFailure' event to the grid returns the following values:
error : TypeError: Cannot read properties of undefined (reading 'cells') at e.render (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7605380) at m (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7610531) at e.refreshRow (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7610625) at e.render (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7608238) at e.refreshContentRows (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7635321) at e.<anonymous> (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7698631) at e.notify (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:624262) at e.trigger (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:652055) at e.dataManagerSuccess (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7696464) at https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7692818
stack: "TypeError: Cannot read properties of undefined (reading 'cells')
at e.render (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7605380)
at m (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7610531)
at e.refreshRow (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7610625)
at e.render (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7608238)
at e.refreshContentRows (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7635321)
at e.<anonymous> (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7698631)
at e.notify (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:624262)
at e.trigger (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:652055)
at e.dataManagerSuccess (https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7696464)
at https://cdn.syncfusion.com/ej2/20.2.44/dist/ej2.min.js:10:7692818"
controller
//grid header binding
publicIActionResultIndexHeaderBinding(string sJobNo,string sMenuName)
{
BomIndexModel model =newBomIndexModel{ JOB_NO = sJobNo, HD_ELEM_TYPE = sMenuName };
ListDataSource=BomIndexModel.DQL(model,"S1");
ListparentHeaderTexts =DataSource.Select(x => x.ITEM_NM).ToList();
parentHeaderTexts = parentHeaderTexts.Where(item =>!string.IsNullOrEmpty(item)).ToList();
ListreturnList =newList ();
foreach(string str in parentHeaderTexts)
{
GridColumn col =newGridColumn
{
Uid=null,
Field= str,
HeaderText= str,
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Right,
AllowResizing=false,
AllowEditing=true,
Width="120",
Type="string",
Edit=new{ create ="Index_Create", read ="Index_Read", destory ="Index_Destory", write ="Index_Write"}
};
returnList.Add(col);
}
returnJson(returnList);
}
//grid data binding
publicIActionResultIndexDataBinding(string sJobNo,string sMenuName,string seqNo)
{
BomIndexModel model =newBomIndexModel{ JOB_NO = sJobNo, HD_ELEM_TYPE = sMenuName, SEQ =int.Parse(seqNo)};
DataTableDataSource=BomIndexModel.DQL_DataTable(model,"S0");
returnJson(DataSource);
}
Attachment: frozen_74dd9391.zip
Hi Taewook,
Please use the latest Syncfusion DLL & script in your project. Let us know if you face any issues with the latest version.
[_Layout.cshtml] <link rel="stylesheet" rel='nofollow' href=https://cdn.syncfusion.com/ej2/20.4.40/material.css />
@* Syncfusion Essential JS 2 Scripts *@ <script src=https://cdn.syncfusion.com/ej2/20.4.40/dist/ej2.min.js></script> |
Regards,
Rajapandiyan S
We finally found the cause and reenacted it
We should use 'colSpan' while using the grid.
Adjusted 'colSpan' using 'queryCellInfo' for data on the grid.
Please tell me what to do after looking at the implementation data.
I have an additional question.
I thought using "colspan" would be a problem, so I applied "colspan" by dividing it back and forth based on "frozen column".
But the problem still occurs.
Please refer to this information when you give me an answer to the above error.
TaeWook,
We have confirmed that the reported behavior is an issue from our side and logged it as - “column spanning is not working with Frozen Grid”. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technical feasibility and Product Development Life Cycle ) and will include the defect fix in our upcoming patch release which will be rolled out on Jan 25th, 2023.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through the below link,
Feedback: https://www.syncfusion.com/feedback/40214/column-spanning-is-not-working-with-frozen-grid
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
TaeWook,
We are glad to announce that our Essential Javascript2 patch release (v20.4.43) has been rolled out successfully and in that release, we have added the fix of “column spanning is not working with Frozen Grid” issue. So, please update your Syncfusion packages to the current version and use latest style script to get this.
Release Notes: https://ej2.syncfusion.com/javascript/documentation/release-notes/20.4.43/?type=all#grid
Find the below sample for your reference.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require further assistance.
Regards,
Rajapandiyan S
Thank you. It works well on my grid.
TaeWook,
We are glad to hear that you have resolved the reported problem with the latest packages.
Please get back to us if you need further assistance.
Regards,
Rajapandiyan S