Hi :)
An error occurs when modifying dynamically generated columns in the grid.
The [Work Master] and [Material Master] columns created with HTML tags are modified normally. However, dynamically generated columns [Total Qty.], [OPP-101-001], [OPP-101-002], and [OPP-101-003] have errors when double-clicked for Edit.
Please refer to the attached video with an error and the cshtml, controller, and model files on the page.
I would appreciate it if you could solve it as soon as possible.
Hi Taewook,
Thanks for contacting Syncfusion support.
You can resolve the reported problem by creating a column with null Uid in the controller side. The refreshColumns method binds the respective uid value to that column. Find the below code and sample for your reference.
|
[HomeController.cs] public IActionResult GridHeaderAndDataBinding(string sJobNo, string sMtoSeq) {
List<GridColumn> headerList = new List<GridColumn>(); GridColumn workTotal = new GridColumn { Field = "WORK_TOTAL", HeaderText = "Work", HeaderTextAlign = TextAlign.Center, TextAlign = TextAlign.Right, Width = "100", Uid = null };
GridColumn matlTotal = new GridColumn { Field = "MATL_TOTAL", HeaderText = "Material", HeaderTextAlign = TextAlign.Center, TextAlign = TextAlign.Right, Width = "100", Uid = null };
List<GridColumn> totalColumns = new List<GridColumn>(); totalColumns.Add(workTotal); totalColumns.Add(matlTotal);
GridColumn totalQty = new GridColumn { HeaderText = "Total Qty.", HeaderTextAlign = TextAlign.Center, TextAlign = TextAlign.Center, Columns = totalColumns };
headerList.Add(totalQty);
for (int i = 0; i < 1; i++) { GridColumn workQtyCol = new GridColumn { Field = $"WORK_QTY{i}", HeaderText = "W.Qty.", HeaderTextAlign = TextAlign.Center, TextAlign = TextAlign.Right, Width = "100", Uid = null };
GridColumn matlQtyCol = new GridColumn { Field = $"MATL_QTY{i}", HeaderText = "M.Qty.", HeaderTextAlign = TextAlign.Center, TextAlign = TextAlign.Right, Width = "100", Uid = null };
List<GridColumn> QtyColumns = new List<GridColumn>(); QtyColumns.Add(workQtyCol); QtyColumns.Add(matlQtyCol);
GridColumn parentCol = new GridColumn { HeaderText = "Dynamic", HeaderTextAlign = TextAlign.Center, TextAlign = TextAlign.Center, Columns = QtyColumns };
headerList.Add(parentCol); } List<object> returnList = new List<object>(); returnList.Add(headerList); returnList.Add(BigData.GetAllRecords()); return Json(returnList); } |
Regards,
Rajapandiyan S
It's perfect.
Thank you always!
Taewook,
We are glad that the provided sample worked to solve the issue. Please get back to us for further assistance.
We are marking this thread as solved.
Regards,
Suganya Gopinath.