EasyUI Forum
May 16, 2024, 05:01:35 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: Display text in propertygrid remote combobox (2)  (Read 9367 times)
mephisto
Newbie
*
Posts: 8


View Profile
« on: September 01, 2013, 08:16:09 AM »

I'll continue here from the previous post (you can find it here: http://www.jeasyui.com/forum/index.php?topic=2079.0)marked as solved from the owner.
Summary:
I've a combobox (provincia) chained to another one (comune).
Both comboboxes are populated from data in mysql.
Actually the chained comboboxes work correctly but when I save on db (in the relate table I've 2 colums (provincia and comune), also using the code in the example presented here: http://jsfiddle.net/hrvKP/, and the row is not anymore editable, I see on the "provincia" column the valueField value and not textField string as expected.

Here the code:
Code:
	<script type="text/javascript">
$(function(){
$('#dgb').edatagrid({
url: 'leggi_records_b.php',
saveUrl: 'salva_records_b.php',
updateUrl: 'aggiorna_records_b.php',
destroyUrl: 'cancella_records_b.php',
columns:[[
{field:'provincia',
title:'PROVINCIA',
width:15,
align:'center',
sortable:'true',
formatter:function(value,row){
return row.provincia;
},
editor:{
type:'combobox',
options:{
url:'combobox_provincia.php',
valueField:'idprovincia',
textField:'siglaprovincia',
required:true,
editable:false,
onChange:function(value){
var index = $(this).closest('tr.datagrid-row').attr('datagrid-row-index');
var ed = $('#dgb').edatagrid('getEditor',{index:index,field:'comune'});
$(ed.target).combobox('reload','combobox_comuninew.php?prov='+value);
var row = $('#dgb').datagrid('getRows')[index];
row['tmpname'] = value;
var data = $(this).combobox('getData');
for(var i=0; i<data.length; i++){
var d = data[i];
if (d['idprovincia'] == value){
row['tmpname'] = d['siglaprovincia'];
return;
}
}
}
}}},
{field:'comune',
title:'COMUNE INTERESSATO',
width:40,
align:'center',
sortable:'true',
editor:{
type:'combobox',
options:{
valueField:'nomecomune',
textField:'nomecomune',
required:true,
editable:false
}
}
}
]],
onAfterEdit:function(index,row){
$(this).edatagrid('updateRow',{
index:index,
row:{provincia:row.tmpname}
});
}

Thanks in advance to anyone can help me to find the definitive solution to this code nightmare Wink
« Last Edit: September 01, 2013, 08:34:53 AM by mephisto » Logged
mephisto
Newbie
*
Posts: 8


View Profile
« Reply #1 on: September 02, 2013, 03:28:54 AM »

I think the problem is in the FORMATTER and ONAFTEREDIT event.

Unlike all the examples about this subject I read and record data in a MySQL DB through php pages.

I've found a post about it: http://www.jeasyui.com/forum/index.php?topic=1050.msg2274;topicseen#msg2274

I keep trying...
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!