Adding OnSelectRow

Nov 5, 2012 at 3:46 PM

I have tried adding a referrence to a custom function to the grid helper's consrtuctor but the only time it is called is during grid initialization.  It never fires when I click on this roww.  I have tried the double click event as well with the same results.  I cannot seem to find a reference to this function in the samples. 

Coordinator
Nov 5, 2012 at 8:12 PM

I would be able to guide you better if I could see some of your code. Following code should show you how to initialize OnSelectRow with anonymous function:

var grid = new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<jqGrid.Models.ProductFormattedViewModel>("gridId",
    ...
    onSelectRow: "function(rowId, status, event) { alert('Selected row: ' + rowId); }",
    ...
);

and with named one:

<script type="text/javascript">
    function onSelectRowHandler(rowId, status, event) {
        alert('Selected row: ' + rowId);
    }
</script>
var grid = new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<jqGrid.Models.ProductFormattedViewModel>("gridId",
    ...
    onSelectRow: "onSelectRowHandler",
    ...
);
Nov 5, 2012 at 10:58 PM

okay great.  That was what I was looking for.  I am not a jqgrid whiz by any stretch and I forget how jqgrid did that particular action.  Now that I see this it is very much like straight jqgrid.  Thanks again.

Nov 5, 2012 at 11:56 PM

okay, yep that did the trick.  What I was doing wrong was that I was typing edit(data) which caused it to blow up.  Didn't realize I just had to type the name of the function.

Feb 15, 2013 at 5:06 PM
What hapen with the id on the onSelectRow when you are grouping by a field? i got the same id for all the records in the same group, how i can change that?
Regards
Coordinator
Feb 15, 2013 at 6:58 PM
Nothing changes, most probably you have set wrong value for the row id. I'm just going to answer in details in your second thread.