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

The columns in the dynamically created grid are not moved.

hi


When I tried to adjust the column size of the grid, the upper column did not move.




Based on the red line, the left side is created in the view, and the right side is created dynamically in the controller.


Moving a triangle position in the figure moved, but moving a circle position did not.


The source code is as follows.

//view

columns="@(new List() {
new Syncfusion.EJ2.Grids.GridColumn { Field = "WORK_CD", HeaderText = "Code", TextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, Width = "96", AllowEditing = false, IsFrozen = true},
new Syncfusion.EJ2.Grids.GridColumn { Field = "WORK_DESC", HeaderText = "Description", HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, Width = "130", AllowEditing = false, IsFrozen = true},
new Syncfusion.EJ2.Grids.GridColumn { Field = "WORK_SHORT_SPEC", HeaderText = "ShortSpecification", HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, DisableHtmlEncode = false, Width = "165", AllowEditing = false, IsFrozen = true},
new Syncfusion.EJ2.Grids.GridColumn { Field = "WORK_UNIT_CD", HeaderText = "Unit", TextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, Width = "50", AllowEditing = false, IsFrozen = true}})">


columns="@(new List() {
new Syncfusion.EJ2.Grids.GridColumn { Field = "MATL_CD", HeaderText = "Code", TextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, Width = "96", AllowEditing = false, IsFrozen = true},
new Syncfusion.EJ2.Grids.GridColumn { Field = "MATL_DESC", HeaderText = "Description", HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, Width = "130", AllowEditing = false, IsFrozen = true},
new Syncfusion.EJ2.Grids.GridColumn { Field = "MATL_SHORT_SPEC", HeaderText = "ShortSpecification", HeaderTextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, DisableHtmlEncode = false, Width = "165", AllowEditing = false, IsFrozen = true},
new Syncfusion.EJ2.Grids.GridColumn { Field = "MATL_UNIT_CD", HeaderText = "Unit", TextAlign = Syncfusion.EJ2.Grids.TextAlign.Center, Width = "50", AllowEditing = false, IsFrozen = true}})">


//controller


List headerList =newList();//최종 Return할 Header data


#region [Total Qty] Column Ojbect
GridColumn workTotal =newGridColumn
{
Uid=null,
Field="WORK_TOTAL",
HeaderText="Work",
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Right,
Width="67",
AllowEditing=false,
AllowResizing=false,
IsFrozen=true
};

GridColumn matlTotal =newGridColumn
{
Uid=null,
Field="MATL_TOTAL",
HeaderText="Material",
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Right,
Width="67",
AllowEditing=false,
AllowResizing=false,
IsFrozen=true
};

List totalColumns =newList();
totalColumns.Add(workTotal);
totalColumns.Add(matlTotal);

GridColumn totalQty =newGridColumn
{
HeaderText="Total Qty.",
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Center,
Columns= totalColumns,
AllowResizing=false
};
#endregion

headerList.Add(totalQty);

#region 동적 Column Create
for(int i =0; i < parentHeaderTexts.Count; i++)
{
GridColumn workQtyCol =newGridColumn
{
Uid=null,
Field= $"{parentHeaderTexts[i]}_WORK_QTY",
HeaderText="W.Qty.",
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Right,
Width="95",
Type="number",
AllowResizing=true
};

GridColumn matlQtyCol =newGridColumn
{
Uid=null,
Field= $"{parentHeaderTexts[i]}_MATL_QTY",
HeaderText="M.Qty.",
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Right,
Width="95",
Type="number",
AllowResizing=true
};

ListQtyColumns=newList();
QtyColumns.Add(workQtyCol);
QtyColumns.Add(matlQtyCol);

GridColumn parentCol =newGridColumn
{
HeaderText= parentHeaderTexts[i],
HeaderTextAlign=TextAlign.Center,
TextAlign=TextAlign.Center,
AllowResizing=true,
Columns=QtyColumns
};

headerList.Add(parentCol);
returnJson(headerList);

3 Replies

PS Pavithra Subramaniyam Syncfusion Team March 17, 2023 07:27 AM UTC

Hi TaeWook Kang,


Thanks for contacting Syncfusion support.


To validate the reported scenario “Moving a triangle position in the figure moved, but moving a circle position did not.” we need some more details from your end. So please share the below details which will be helpful for us to provide a better solution as early as possible.


  1. Share the full Grid code example.
  2. Share the video demo of your issue.
  3. Share the Syncfusion package version.
  4. Is there any script error?
  5. Share an issue reproducible sample which will be easier to validate the issue.


Regards,

Pavithra S



TK TaeWook Kang March 22, 2023 04:15 AM UTC

Hi. Pavithra

Attach the failed source code and video.


  Regards


Attachment: Grid_Column_error_9b2c2378.zip


PS Pavithra Subramaniyam Syncfusion Team March 23, 2023 06:12 AM UTC

Hi TaeWook Kang,


Thanks for sharing the details.


We have validated the sample and found that the issue occurs due to the default values assigned to the Grid columns which are received from the server. So, we suggest resetting these values to overcome the resizing issue.


function DataBinding(args) {

 

        .   .   .

 

        $.ajax({

            .   .  .

            success: function (returnData) {

                var headerData = returnData[0];

                var gridDataSource = returnData[1];

 

                dynamicHeaderLength = headerData.length;

 

                for (var i = 0; i < headerData.length; i++) {

                    headerData[i].field = headerData[i].field == '' ? undefined : headerData[i].field;

                    headerData[i].index = undefined;

                    headerData[i].uid = undefined;

                    headerData[i].freeze = undefined;

                    grid.columns.push(headerData[i]);

                }

                //grid.frozenColumns = 11;

                grid.refreshColumns();

 

                grid.dataSource = ej.data.DataUtil.parse.parseJson(gridDataSource);

 

            }

        });

    }



Loader.
Up arrow icon