EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: markalves on December 13, 2021, 03:38:19 AM



Title: [SOLVED] Datagrid parameter to combobox field url
Post by: markalves on December 13, 2021, 03:38:19 AM
Hi,
I have a datagrid and this combobox field :

<th field="idarticolo" width="250px" formatter="formatta" editor="{type:'combobox',  options:{valueField:'id',textField:'offerta',url:'ajax/wsgetofferta.php',required:true}}">Articolo</th>

And this SELECT in HTML page:

<select  name="firm" id="firm">
  <option value="pippo">PIPPO</option>
  <option value="pluto">PLUTO</option>
</select>

I would like to add a parameter to the combobox url based on the value of select,
i.e.:
"ajax/wsgetofferta.php?firm=" + document.getElementById("firm").value

is it possible ?


Title: Re: Datagrid parameter to combobox field url
Post by: jarry on December 14, 2021, 01:54:50 AM
Please set the editor's 'url' property value before editing a row.
Code:
$('#dg').datagrid({
  onBeforeEdit: function(index,row){
    var row = $(this).datagrid('getRows')[index];
    var col = $(this).datagrid('getColumnOption', 'idarticolo');
    col.editor.options.url = 'ajax/wsgetofferta.php?firm='+row.idarticolo;
  }
})


Title: Re: Datagrid parameter to combobox field url SOLVED
Post by: markalves on December 16, 2021, 01:43:14 AM
Thank you very much it worked