I'm a winforms developer, but now find myself having to write for the web. I've done a few simple sites in the past, but this one is way more complex. Since I'm a noob anyway, I went with MVC3 and Razor. But if I can't figure out how to do this soon, I'm just going to skip the grid and use a table... or skip MVC all together and go to web forms.
I'm using MVC3 with Razor view engine.
Since there is no built in CRUD functionality with the grid, I'm looking to simply add a link that will allow the user to Edit, Delete, or View Details for the currently selected row.
I have a grid that is displaying a list of <object> and I can select individual rows just fine. However, I'm unsure of how to proceed. I found the information at http://help.infragistics.com/Help/Doc/jQuery/2011.1/CLR4.0/html/igGrid_Selection.html
to be insufficient for my level of experience.
While I can bind to the iggridselectionrowselectionchanged event with javascript, and I can alert in the Handler function to show that it is being hit when a row is selected, I'm not sure where to go from here. I know very little javascript. I just want to hit a specified action in the current controller and have available the currently selected row.
Can anyone provide me with a snippet or two demonstrating this type of functionality? Is there a better way than what I'm trying to do, or an alternative that doesn't involve using Javascript?
Thanks,Tony
Hello Tony,
Thank you for posting in our forums.
First of all I would recommend you waiting for the editing funtionality which is currently CTP
https://www.igniteui.com/grid/overview
Regariding the implementation of your scenario you can iterate through the cells of the selected row
and get their values.
How to get specific cell value you can find more code snippets here:
https://www.igniteui.com/grid/grid-api-events
You can find more information regarding the selection API here:
https://www.igniteui.com/grid/selection
Please refer to the jQuery API for more information :
https://www.igniteui.com/help/api/2013.2/
Let us know if you need further assistance.
Thank you very much!
The Editing CTP looks great. However, I did notice that I could delete rows without any kind of warning to the user (i.e. "Are you sure you want to delete this record?") Hopefully we can easily implement that functionality, or turn it on in the grid.
Is there an ETA on the official release of this feature?
Early November.
Hi Anthony,
In order to process events on client for igGridUpdating and other behaviors/features of igGrid, you may use codes similar to example below. Events that end with "ing" can be canceled by returning the false from event handler. The second "ui" parameter in handler contains varios members related to event. So, they can be used to define/modify/cancel action. You may consult documentation or you may insert the "debugger;" statement in handler and check members of ui.
$("#igGrid1").live("iggridupdatingrowdeleting", function (event, ui) { var ok = confirm('Do you want to delete row ' + ui.row); // debugger; if (!ok) { return false; }});$("#igGrid1").live("iggridupdatingeditrowending", function (event, ui) { // debugger; if (ui.update) { var ok = confirm('Do you want to update row ' + ui.row); if (!ok) { return false; } }});
Thank you Viktor.
This will be exactly what I need when this feature is released.