0

I am using Jquery grid to populate my data. In one of my grids, I am populating nested object using,

{
name : 'student.roll',
index : 'student.roll',
sortable: false,
width : 120

}

Now that, I need to parse the list of roll numbers for some manipulation.

var lista = jQuery("#student-grid").getDataIDs();
 for(i=0;i<lista.length;i++){
rowData=jQuery("#student-grid").getRowData(lista[i]);

 }

From this when i try to get rowData.student.roll, its trying to fetch an object called student but its a field name out there. How can I fetch the value of roll from jqgrid? Please help.

Poppy
  • 2,902
  • 14
  • 51
  • 75

2 Answers2

1

You can use rowData["student.roll"] form. By the way I don't recommend you to use name property in colModel with special characters like .. You can use jsonmap or xmlmap mostly to read the data from the server which have having special characters in the name. For example name: 'student_roll', jsonmap: 'student.roll' will be better. In some more complex cases you can use jsonmap defined as functions (see the answer for more references to code examples).

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thanks! it worked perfectly :) i used rowData['student.roll']. But now I am changing my colModel.. – Poppy Oct 11 '13 at 13:04
1

ok you can do it in this way...

<script type="text/javascript">
        $(document).ready(function () {
            $(".button").click(function (e) {

                var value= $(this).closest('tr').find("span[id*=student-grid]").text();

                alert(value);
                e.preventDefault();
            });
        });
    </script>
Mayur Gupta
  • 762
  • 3
  • 8
  • 23