EasyUI Forum
May 06, 2024, 11:19:17 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: chain combo inline editor  (Read 28433 times)
putusundika
Newbie
*
Posts: 13


View Profile Email
« on: August 08, 2012, 08:10:51 PM »

how can i make a chain combobox inline editing ? for common sample in datagrid : city | country.
city load database. but after selection on city, combobox on country will displaying only related item from city.
i've read combo-tree sample, but still dont know how to implement it to inline editor with separate column.

best regards
putu
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 09, 2012, 06:10:54 PM »

It is similar with this tutorial http://www.jeasyui.com/tutorial/datagrid/datagrid15.php.
To solve your issue, define two column with 'combobox' editor: city and country. In the city combobox bind 'onChange' event, in which get the new city value and then reload the country combobox data. The code looks like this:

Code:
$('#dg').datagrid({
columns:[[
{field:'city',title:'City',width:100,
editor:{
type:'combobox',
options:{
onChange:function(value){
// get the country editor
var ed = $('#dg').datagrid('getEditor',{index:idx,field:'country'});
// reload its data
$(ed.target).combobox('reload','get_data.php?city='+value);
}
}
}
},
{field:'country',title:'Country',width:100,editor:{type:'combobox',options:{...}}}
]]
});
Logged
putusundika
Newbie
*
Posts: 13


View Profile Email
« Reply #2 on: August 18, 2012, 05:46:10 AM »

hii..
i'ved try this but not working.
inline edit, i have 2 column editor, partname (combobox) and quantity(numberbox).
quantity will show the last quantity of selected partname.
so, actualy it's not a editor. but i dont know how to do that. Thats why i try with editor (numberbox) .
but not working.

please help me, there must be something wrong in mycode below.

Code:
function tagData(){
var row = $('#dg').datagrid('getSelected');
var idd;
if (row){
 $('#dlgtag').dialog('open').dialog('setTitle','Set Supplier');
 $(function(){
   $('#dlgt').edatagrid({
   onEdit:function(index,row){ idd=index;},
   onAdd:function(index,row){idd=index;},
   url: 'get_data1.php?id='+row.idfbstockopname,
   columns:[[
   {field:'name_part',title:'Part Name',width:200,editor:{type:'combobox',options: 
     {url:'part.php',valueField:'id_part',textField:'name_part',required:true,
      onChange:function(value){
var ed = $('#dlgt').edatagrid('getEditor',{index:idd,field:'lastqty_fbstockopname_detil'});
$(ed.target).numberbox('setValue',value);},
}}},
        {field:'lastqty_fbstockopname_detil',title:'Quantity',align:'left',width:100,editor:{type:'numberbox',}
}}
]],
});
});}
    }


best regards
« Last Edit: August 18, 2012, 05:54:53 AM by putusundika » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: August 20, 2012, 02:07:01 AM »

Please refer to this example: http://jsfiddle.net/Ynkyq/
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!