We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dynamically generated column 'frozenColumn'

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.");

           }

       });




Attachment: frozen_column_e152935e.zip

12 Replies 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team December 22, 2022 04:38 AM UTC

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.



<script>

  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



TK TaeWook Kang December 28, 2022 01:11 AM UTC

 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.​



RS Rajapandiyan Settu Syncfusion Team December 28, 2022 12:49 PM UTC

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.


  1. Share the issue reproducible sample to try to replicate the issue in given sample.
  2. Share the complete code of gridCols and gridData values used in the ajax success event.
  3. Bind the actionFailure event to the Grid and let us know if you face any exceptions or errors in that event.


 

   function actionFailure (args) {

        console.log(args);

    }

 


Regards,

Rajapandiyan S



TK TaeWook Kang December 29, 2022 03:46 AM UTC

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"




TK TaeWook Kang December 29, 2022 03:55 AM UTC

controller

//grid header binding
publicIActionResultIndexHeaderBinding(string sJobNo,string sMenuName)
{
BomIndexModel model =newBomIndexModel{ JOB_NO = sJobNo, HD_ELEM_TYPE = sMenuName };
ListDataSource=BomIndexModel.DQL(model,"S1");


List parentHeaderTexts =DataSource.Select(x => x.ITEM_NM).ToList();
parentHeaderTexts = parentHeaderTexts.Where(item =>!string.IsNullOrEmpty(item)).ToList();


List returnList =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



RS Rajapandiyan Settu Syncfusion Team December 30, 2022 09:07 AM UTC

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]

    @* Syncfusion Essential JS 2 Styles *@

    <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


Marked as answer

TK TaeWook Kang January 2, 2023 11:26 PM UTC

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.


Attachment: columnFreezeError_d2e52336.zip


TK TaeWook Kang January 5, 2023 07:52 AM UTC

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.



RS Rajapandiyan Settu Syncfusion Team January 5, 2023 11:55 AM UTC

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.



RS Rajapandiyan Settu Syncfusion Team January 11, 2023 12:59 PM UTC

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.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/core_grid_frozen_colSapn_resolved937375517.zip


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



TK TaeWook Kang January 11, 2023 11:44 PM UTC

Thank you. It works well on my grid.



RS Rajapandiyan Settu Syncfusion Team January 12, 2023 03:54 AM UTC

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


Loader.
Up arrow icon