0

私はこれでGrailsビューを持っています

<script type="text/javascript">
    /* when the page has finished loading.. execute the follow */
    $(document).ready(function () {
        jQuery("#customer_list").jqGrid({
          url:'jq_customer_list',
          datatype: "json",
          colNames:['customer','location','id'],
          colModel:[
            {name:'customer'},
            {name:'location',stype:'select', searchoptions:{value:':All;USA:USA;Canada:Canada;Carribean:Carribean;USPacific:USPacific;'}},
            {name:'id', hidden:true}
          ],
          rowNum:2,
          rowList:[1,2,3,4],
          pager: jQuery('#customer_list_pager'),
          viewrecords: true,
          gridview: true,
          multiselect: true
        });
        $("#customer_list").jqGrid('filterToolbar',{autosearch:true});
    });
    </script>
<g:link controller="MyController" action="downloadFile">Download</g:link><br>
  </div>
<br/><br/>

ここで、選択した行のデータをこのアクションに渡したいと思います。しかし、私はこれをどこにも見つけることができません。

現在、コントローラーのメソッドは空白です。選択した値のすべての ID をコンソールに出力したいと思います。

助言がありますか?ありがとう

4

1 に答える 1

1

これでうまくいくはずです。

onSelectRow: function(rowid, iRow, iCol, e){
    console.log('Id of Selected Row: ' + $(this).jqGrid('getCell', rowid, 'id'));
}
于 2013-01-21T19:15:29.917 に答える