I have a grid in which the row has two values that are selected from combo boxes and single check box value. I want to disable the editing for the two combo box values but allow the values to be selected from the combo boxes when a new row is added.How can I get this to work?
In short, I want the grid to disable some columns while editing but i want the same fields to be available if +Add Row is selected.
I am using Asp.Net MVC Helper , and I am generating Columns from my ViewPage(.cshtml). A short sample would help.
Hello Omer,
Thank you for posting in our community!
What I can suggest for achieving your requirement is handling the editCellStarting event of the igGrid. In this event it could be cheked whether it is triggered from row adding or from an already existing row in the grid. In case that it is fired from already existing row next step is to check from which column. If the column is from the ones that you would like to be read only the event could be canceled. In this scenario, when you are adding a new row all the cells are going to be editable, however, the cells already in the grid are going to be read only. For example:
<script type="text/javascript"> $(document).delegate("#grid1", "iggridupdatingeditcellstarting", function (evt, ui) { if (ui.rowAdding) { } else { if( ui.columnKey == "isActive") { } else return false; } }); </script>
<script type="text/javascript">
$(document).delegate("#grid1", "iggridupdatingeditcellstarting", function (evt, ui) {
if (ui.rowAdding) {
}
else {
if( ui.columnKey == "isActive")
{
else
return false;
});
</script>
I made a small sample illustrating my suggestion and I am attaching it for you reference.
Please let me know if you have any further questions regarding this matter.
This works.. Thanks alot.