jquery - JqueryGrid plugin getting selected row id -
i using jquerygrid plugin. want implement easy edit function. user click jquery grid column edit button. redirect edit view. want that. must selected column's id value. code shown below:
<script type="text/javascript"> jquery(document).ready(function () { $('#list').width(200); jquery("#list").jqgrid({ url: '/credential/jquerygriddata/', datatype: 'json', mtype: 'get', colnames: ['id', 'sıra', 'resim', 'İsim', 'başlık', 'açıklama', 'boyut', 'oluşturulma tarihi', 'güncellenme tarihi'], colmodel: [ { name: 'id', index: 'id', width: 10, align: 'left' }, { name: 'order', index: 'order', width: 10, align: 'center' }, { name: 'image', index: 'image', width: 50, height: 25, align: 'center' }, { name: 'name', index: 'name', width: 40, align: 'left', search: true, stype: 'text', searchoptions: { sopt: ['eq', 'ne'] } }, { name: 'title', index: 'title', width: 40, align: 'left' }, { name: 'description', index: 'description', width: 100, align: 'left' }, { name: 'size', index: 'size', width: 20, align: 'center' }, { name: 'createddate', index: 'createddate', width: 20, align: 'center' }, { name: 'updateddate', index: 'updateddate', width: 20, align: 'center' }], pager: jquery('#pager'), editurl: '/credential/jquerygriddata/?id=44', loadtext: 'yükleniyor lütfen bekleyiniz', rownum: 17, rowlist: [17, 34, 53, 70], sortname: 'id', width: 1100, height: 400, sortorder: "desc", viewrecords: true, imgpath: '/scripts/themes/coffee/images', caption: 'referans listesi' }); $("#list").jqgrid('navgrid', '#pager', { /* parameters */ edit: false, add: false, del: false, searchtext: 'ara', refreshtext: 'yenile' }, { /* edit options */ }, { /* add options */ }, { /* delete options */ }, { /* search options */ multiplesearch: false, multiplegroup: false, showquery: false, top: 190, left: 200, caption: "ara", closeaftersearch: true, sopt: ['cn'], }, { /* view options */ } ); $('#pager_left').append('<table cellspacing="0" cellpadding="0" border="0" class="ui-pg-table navtable" style="float:left;table-layout:auto;"><tbody><tr><td class="ui-pg-button ui-corner-all" title="yeni" id="search_list2"><div class="ui-pg-div"><a href="/management/credential/create/"><span class="ui-icon ui-icon-plus"></span></a></div> </td></tr></tbody></table>'); $('#pager_left').append('<table cellspacing="0" cellpadding="0" border="0" class="ui-pg-table navtable" style="float:left;table-layout:auto;"><tbody><tr><td class="ui-pg-button ui-corner-all" title="düzenle" id="search_list2"><div class="ui-pg- div"><a href="/management/credential/edit/5"><span class="ui-icon ui-icon-pencil"></span> </a></div></td></tr></tbody></table>'); }); </script>
i added edit button line :
$('#pager_left').append('<table cellspacing="0" cellpadding="0" border="0" class="ui- pg-table navtable" style="float:left;table-layout:auto;"><tbody><tr><td class="ui-pg-button ui-corner-all" title="düzenle" id="search_list2"><div class="ui-pg-div"><a href="/management/credential/edit/5"><span class="ui-icon ui-icon-pencil"></span></a></div> </td></tr></tbody></table>');
in line "/management/credential/edit/5" must send selected row id controller. supposed ?
first of have set "editable:true" column u want edit.
then add following code:
onselectrow: function(id,e){ jquery('#list').editrow(id) }
and can't send parameters in editurl. have call "extraparam" inline editing send parameters. refer [this] http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing
Comments
Post a Comment