Replies
Hello Vanitha,
Please refer to the following column declarations from your code snippet:
.Columns(c =>
{
c.MultiColumnHeader("UserId").HeaderText("USer Id").Format("string");
c.MultiColumnHeader("UserName").HeaderText("User Name").Format("string");
c.MultiColumnHeader("Mobile").HeaderText("Mobile No").Format("string");
c.MultiColumnHeader("Email").HeaderText("Email Id").Format("string");
});
Please note that the MultiColumnHeader declaration indicates that a multi-column header will be created.They serve as a group headers for the actual data columns but are not data columns themselves.You can read more about the multi-column headers here:
https://www.igniteui.com/help/iggrid-multicolumnheaders-configuring
If you wish to define data columns you can do so with the chaining syntax described in the documentation link I’ve previously provided you. Here’s an example:
@(Html.Infragistics()
.Grid(Model)
.AutoGenerateColumns(false)
.Columns(column => {
column.For(x => x.Name).HeaderText(“Full Name”);
column.For(x => x.Age).HeaderText(“Age”);
})
…
Please read through the documention as it contains code snippets and detailed explanations you may find useful when configuring your grid:
https://www.igniteui.com/help/iggrid-developing-asp-net-mvc-applications-with-iggrid#syntax-chaining
Let me know if you have any questions or concerns.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello vanitha,
It appears that the columns you’re defining are multi-column headers and not normal data columns.
Those types of columns are not bound to any data, hence will not works as expected with the Updating feature.
I suggest you refer to the following topic, that gives an example on how to define an igGrid in a MVC application:
https://www.igniteui.com/help/iggrid-developing-asp-net-mvc-applications-with-iggrid#syntax-chaining
And follow the steps defined there in order to defined and set your columns as data columns.
Let me know if you have any questions.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello vanitha,
Showing/Hiding column should not affect the grid’s data in any way.
You can refer to the following jsfiddle example:
http://jsfiddle.net/1krLwpsh/
Where the fist column can be hidden/shown using the API methods via the button. Note that the data is not affected by the hiding/showing operations.
Please test this on your PC; whether or not it works correctly may help indicate the nature of this problem.
If it’s working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Or, if this sample is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello vanitha,
Thank you for posting in our forum.
If you want to initially hide some columns based on a condition you can set the related columns’ hidden option based on that condition:
https://www.igniteui.com/help/api/2017.2/ui.iggrid#options:columns.hidden
The igGrid has two API methods for showing/hiding columns runtime, which you can also use:
https://www.igniteui.com/help/api/2017.2/ui.iggrid#methods:hideColumn
https://www.igniteui.com/help/api/2017.2/ui.iggrid#methods:showColumn
Let me know if you have any additional questions or concerns on how set the options or how to use the show/hide API methods.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello mcseidel ,
Might be a timing issue. Since the grid’s records are all re-rendered when the data source is changed you might be trying to enter edit mode for a row that is not yet rendered or you may be trying to get the editor before it has been fully initialized.
I suggest you debug it to see what is available at each step.
As for checking if the grid has been destroyed. By default all widget instances are stored via jQuery.data() with the widget's full name as the key and get removed when the widget is destroyed.
So $(“.selector”).data(“igGrid”) will return the widget instance if there’s an igGrid instance on the related element or it will return undefined if there is no such widget (it's not initialized yet or it has been destroyed).
Let me know if there is anything else I can help you with.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello mcseidel ,
Thank you for posting in our forum.
Initially the editor providers are not instantiated on the page so the related API method (editorForKey) will always return null. Once the grid enters edit mode for the first time all editors are instantiated and the same instances will be used when the grid is rebound (they will not be destroyed and recreated when you call dataBind on the grid). Once the editors are created changes made to the column settings will not be reflected on them.
So at the moment the following is happening in your scenario:
1.When the page is initially loaded the editors don’t exist yet so the call to editorForKey will return null. You’re setting new options to the column settings which will get applied once the editors are initialized. As a result the combo’s data source will be applied properly since the first time you enter edit mode for the row the editor will be created with the current column settings, which now contain your dataSource.
2. When the grid is rebound the editors will still exist (they don’t get destroyed when the grid is re-bound) so any additional changes you apply to the column settings will not take affect (they are only used when the editor is first created). As a result the change you apply to the columnSettings will not be reflected in your combo editor.
There are two possible solutions:
1. Check if the editor is created. If not then force it to be created (for example by programmatically entering edit mode via startEdit api method) and set/get the data source from the editor’s instance.
2. Destroy and recreate the whole grid. In this case everything will be destroyed and you can recreate the grid with the new column settings for your editors.
The second one might have a bigger performance hit since all widget instances will be destroyed and then created again.
I’ve attached a sample with the first one for your reference.
If you like the second solution better then refer to the destroy api method:
http://www.igniteui.com/help/api/2013.2/ui.iggrid#methods:destroy
After the grid is destroyed you’d need to initialize it again, for example: $(“.selector”).igGrid(<newOptions>);
Let me know if you have any additional questions.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello ahmed salah,
Thank you for posting in our forum.
It appears that you’re currently not using an igGrid for displaying and editing your data.
If you’d like to use the igGrid control for editing your data you can refer to the following example that showcases the functionality and different options available:
http://www.igniteui.com/grid/editing-api-events
If you’d like to cancel the value change for a specific column in a igGrid you can use the editCellEnding event that the grid provides:
http://www.igniteui.com/help/api/2016.1/ui.iggridupdating#events:editCellEnding
The event arguments provide both the current edited value (ui.value) and the old value (ui.oldValue).
Let me know if you have any question in regard to the igGrid.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support