EasyUI Forum
May 14, 2024, 03:11:57 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] Datagrid parameter to combobox field url  (Read 3761 times)
markalves
Newbie
*
Posts: 15


View Profile
« 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 ?
« Last Edit: December 16, 2021, 01:43:49 AM by markalves » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 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;
  }
})
Logged
markalves
Newbie
*
Posts: 15


View Profile
« Reply #2 on: December 16, 2021, 01:43:14 AM »

Thank you very much it worked
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!