Title: how to get specific field value of row on edatagrid to pass in URL editor Post by: putusundika on August 11, 2012, 10:04:15 PM hi there..
i have datagrid (edatagrid), retrieve from table PART (part,idsupplier) edatagrid has 2 column with only one is inline editing (combobox). This combobox will retrieve data from table SUPPLIER (idsupplier,namesupplier) through URL supplier.php. and everythings OK. But, since datagrid only for editing (no addrow), and each supplier have a category, I need to add parameter on url. so the new URL is supplier.php?idcat=XX. (contains of each combobox is different each row, depends on idcat. "XX" will be the value of field idpart on table PART. How do I write down this XX value ? Code: <table id="dlgt" toolbar="#toolbartag" pagination="true" rownumbers="true" fitColumns="false" singleSelect="true" idField="idpart"> <thead> <tr> <th field="part" width="200" sortable="true">Part</th> <th field="namesupplier" width="350" sortable="true" editor="{type:'combobox', options{url:'supplier.php?idcat=XX', valueField:'idsupplier', textField:'namesupplier', required:true}}">Supplier</th> </tr> </thead> </table> thanks for your great support.. best regards Putu Title: Re: how to get specific field value of row on edatagrid to pass in URL editor Post by: stworthy on August 12, 2012, 07:17:22 PM When editing a row, the 'onEdit' event will be triggered, in which the 'idcat' field value is available. Please download the updated edatagrid plugin from below link:
http://www.jeasyui.com/extension/downloads/jquery-easyui-edatagrid.zip Code: $('#dlgt').edatagrid({ onEdit:function(index,row){ var ed = $(this).edatagrid('getEditor',{ index:index, field:'namesupplier' }); $(ed.target).combobox('reload','supplier.php?idcat='+row.idcat); } }); Title: Re: how to get specific field value of row on edatagrid to pass in URL editor Post by: putusundika on August 15, 2012, 09:03:53 AM awesome, thank you stworthy
this is my final code : Code: function tagData(){ var row = $('#dg').datagrid('getSelected'); if (row){ $('#dlgtag').dialog('open').dialog('setTitle','Set Supplier'); $(function(){ $('#dlgt').edatagrid({ onEdit:function(index,row){ var ed = $(this).edatagrid('getEditor',{ index:index, field:'name_supplier' }); $(ed.target).combobox('reload','supplier.php?id='+row.id_part_cat); }, url: 'get_data1.php?id='+row.idfbrequestpo, updateUrl: 'update_ing.php?idx='+row.idfbrequestpo, columns:[[ {field:'name_part',title:'name of part',width:100, editor:{type:'text'}}, {field:'name_supplier',title:'supplier',width:100, editor:{type:'combobox',options:{ valueField:'id_supplier',textField:'name_supplier',required:true}} } ]], }); });} } now, only related part category will be listed in combobox. regards putu |