Hi Torbian,
Thanks for using Syncfusion products.
Query #1: Allow Editing only certain Columns of the added row? Is that possible?
Yes, we have a default property AllowEditing to set true or false to enable or disable the editing support in the particular column. Please refer the following code snippet.
col.Field("Verified").HeaderText("Verified").EditType(EditingType.Boolean).AllowEditing(false).DefaultValue(true).Width(100).Add(); |
Note: AllowEditing will set as false automatically to the template column.
Query#2: When I add a row to the aforementioned grid, the columns are put in the wrong way. They are all pushed one position to the right.
For your kind information, we need to set IsPrimaryKey for identity column to avoid this issue.
Based on your requirement we have created a sample and same can be downloaded from following location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/118715/ColumnTemplate-22289611.zip
Please let us know if you need any concerns.
Regards,
Sellappandi R
Hi Torbian,
Thanks for the update. Please find the response below.
Query #1: If I set AllowEditing in the Customer ID column, it is still editable after I add a row.
Based on your requirement we have created a sample that can be downloaded from following link location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/118715/ColumnTemplate2121238075.zip
In the provided sample we have used CellEdit event to ignore the edit operation in particular column while adding the new record. Please refer the following code snippet.
.Columns(col => { col.HeaderText("Picture").Template(true).TemplateID("#photoTemplate").TextAlign(TextAlign.Right).Width(120).Add(); col.Field("CustomerID").HeaderText("Customer ID").Width(80).DefaultValue("This is Customer ID").Add(); … }).ClientSideEvents(e=>e.CellEdit("cellEdit")) ) <script> function cellEdit(args) { if (args.columnName == "CustomerID" && args.cell.parent().hasClass("e-insertedrow")) args.cancel = true; } |
Query #2: In your example it looks correct, because you moved the tested columns before the picture. After the picture, the columns are still wrong.
We were able to reproduce the problem and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Please let me know if you have any questions.
Regards,