Hi,
i am using grid edit mode as row and i have two butons inside the grid. once clicking on any of the button, grid row edit mode is opening.
Is there any way we can avoid grid edit mode for the unbound columns or for the readonly columns.
Thanks
Nitesh
Hello Nitesh,
Are there any further questions I may be able to assist you with on this matter?
Thank you very much for updating me on your solution. I am glad you were able to achieve your desired functionality. Please let me know if I can be of further assistance.
i tried with below approach and it's working fine for parent and child grid buttons.
function editRowfun(e, ui) { var cell = $("#grid1").igGridSelection("activeCell"); alert(cell);//
var index =ui.owner.grid._activeCell.index; // Here i am getting cell index
if (index == 3 || index == 5 || index == 6) { return false; }}
if any one have another approach please post to this thread.
Thanks,
Hi Joe,
i did exactly the same what you are suggesting but i am getting error. i have attached screen shot for reference.
The same behavior i am able to get it from script syntax but i am trying to achieve it by below code:
@(Html.Infragistics().Grid(Model.categories).ID("grid1").Width("100%").LoadOnDemand(false).AutoGenerateColumns(false).AutoGenerateLayouts(false).Columns(column =>{ column.For(x => x.ID).Hidden(true); column.For(x => x.CategoryName).HeaderText("Category Name").Width("30%"); column.For(x => x.Description).HeaderText("Description").Width("70%");column.For(x => x.button1).HeaderText("").Template("<input type=\"button\" value=\"Button1\" data-id=\"${ID}\" onclick=\"Buttonverify(this)\"/>").Width("6%"); Working Fine }).PrimaryKey("ID").Features(features =>{ features.Responsive().EnableVerticalRendering(false); features.Selection().Mode(SelectionMode.Cell).Activation(true); features.Updating().EditMode(GridEditMode.Row).EnableAddRow(false).EnableDeleteRow(false).Inherit(true).ColumnSettings(cs => { cs.ColumnSetting().ColumnKey("button1").ReadOnly(true); }).AddClientEvent("editRowStarting", "editRowfun");}).ColumnLayouts(layouts =>{ layouts.For(x => x.Products) .Width("100%") .ForeignKey("CategoryID") .AutoGenerateColumns(false) .RenderCheckboxes(true) .Columns(column => { column.For(x => x.ID).Hidden(true); column.For(x => x.ProductName).HeaderText("Product Name").Width("40%"); column.For(x => x.UnitPrice).HeaderText("Unit Price").Width("20%"); column.For(x => x.UnitsInStock).HeaderText("Units In Stock").Width("20%");column.For(x => x.button1).HeaderText("").Template("<input type=\"button\" value=\"Button1\" data-id=\"${ID}\" onclick=\"Buttonverify(this)\"/>").Width("6%"); // Getting null value .Features(features => { features.Selection().Mode(SelectionMode.Cell).Activation(true); features.Updating().EditMode(GridEditMode.Row).EnableAddRow(false).ColumnSettings(cs => { cs.ColumnSetting().ColumnKey("button1").ReadOnly(true); }).AddClientEvent("editRowStarting", "editRowfun"); }); }).UpdateUrl(Url.Action("EditingSaveChanges")).DataSourceUrl(Url.Action("editing-dataset")).Render())
// function editRowfun(e, ui) { var cell = $("#grid1").igGridSelection("activeCell"); alert(cell);// if (cell.index == 3 || cell.index == 5 || cell.index == 6) { return false; } } // ]]>
I am getting Null value when i click it from Child grid.
can any one help me on this issue.
After reviewing your code it looks to me like your issue lies in your selector in the line:
When you use the $("#grid1") selector, you may be referring to your parent grid only. This would explain why you get a null reference for cell because you are trying to select the active cell in the parent grid which does not exist. This is because you are selecting a cell in the child grid meaning the active cell is in the child rather than the parent. Therefore, we want to reference the currently selected item in the child grid. This can be done with the use of the $(this) selector. $(this) will select the child grid from which we can then reference the active cell. Please refer to my code snippet below:
This should allow cell to reference the cell in the child grid as desired. You may find this sample helpful as a reference for igHierarchicalGrid: http://igniteui.com/hierarchical-grid/editing-dataset
I hope this helps. Please let me know if you have any further questions.