-2

I've checked the jqgrid documentation page, and also here, here and here but none of them answers my problem.

I have a jqgrid with the inline navigator (the buttons at the bottom left of the grid that allow adding/editing rows) displayed.

The grid has a hidden column, with the name hidden_col.

I would like to make the following - When the user selects a row and tries to delete it, the javascript makes an alert - which shows the value of hidden_col for the selected row.

For this, I have the following code

$("#myjqgrid").jqGrid('navGrid',"#myjqgrid_pager",
    {}, //options
    {}, // edit options
    {}, // add options
    {   mtype:"POST",
        reloadAfterSubmit:true,     //Reload data after deleting
        onclickSubmit: function(rowid)
        {           
          var rowData = $('#broadcast_table').jqGrid('getRowData', rowid);
          alert(rowData);
        }
    }, // del options
    {} // search options);
    );

The alert returns "[Object object]". How can I get the value of hidden_col?

I tried adding

var col_value = rowData.hidden_col;

And

var col_value = rowData['hidden_col'];

But both return undefined.

I checked the value in rowid - it is correct. I also know that hidden_col has a value for each row.

What can I be doing wrong?

Community
  • 1
  • 1
PDoria
  • 552
  • 2
  • 11
  • 25

1 Answers1

2

Turns out I was not using the parameter "rowid" as I should.

Here is the code, which I replaced in the first post, that does what I want:

onclickSubmit: function(){
                        var selected_row = $('#myjqgrid').jqGrid('getGridParam', 'selrow');
                        var rowdata = $('#myjqgrid').getRowData(selected_row);

                        alert(rowdata.hidden_col);
                         }
PDoria
  • 552
  • 2
  • 11
  • 25