EasyUI Forum
May 15, 2026, 08:22:01 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / EasyUI for jQuery / Re: Display text in propertygrid remote combobox (2) 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...
2  General Category / EasyUI for jQuery / Display text in propertygrid remote combobox (2) 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
3  General Category / EasyUI for jQuery / Re: [Solved] Display text in propertygrid remote combobox on: September 01, 2013, 08:13:51 AM
Cannot find a solution to my problem, also trying to implement your example.
I've opened another discussion about the same argument here:

http://www.jeasyui.com/forum/index.php?topic=2147.0
4  General Category / EasyUI for jQuery / Re: Display text in propertygrid remote combobox on: August 25, 2013, 05:36:18 AM
Already tried to add
Code:
formatter:function(value,row){
return row.here_the_name_of_textField_of_the_field;
},
in both fields (provincia and comune).
For what I've understood from the example linked I've also to write a "function endEditing" that I don't know how to trig and however is totally out of my abilities.

What I don't understand is why the control must have a similar default behavior especially considering the control already record a valueField and a textField. I supposed that valueField was machine useful to interact with DB, textField for human readability.

However at the time I'm stuck on the problem.
5  General Category / EasyUI for jQuery / Re: combobox loading other combobox on: August 24, 2013, 12:31:07 PM
You have to use the code in the example of dependent comboboxes you can find here http://www.jeasyui.com/documentation/combobox.php

I'm not an expert so It's preferable you listen other opinions but actually I've problems with the formatter function so I'd remove it in test phase.
I think also you don't need "data:cmbaxcodes," in field "axCode": jquery will fill this combobox with the onSelect function declared.
6  General Category / General Discussion / Re: Chain Combo Inline editor (2) [Solved] on: August 24, 2013, 12:18:12 PM
Perfect!
your code solved the problem!
7  General Category / EasyUI for jQuery / Re: Display text in propertygrid remote combobox on: August 24, 2013, 11:51:33 AM
Same problem here.
I've two chain combobox in edatagrid.
I need to use, for each combobox, different valueField and textField to chain them and relate data in DB (I pass $prov=valueField variable in php to populate second combobox).
When I edit a combobox it's all ok, but when I deselect the row I see the valueField in cell, not the textField.
Here is the code:
Code:
columns:[[
{field:'provincia',title:'Provincia',width:400,
editor:{
type:'combobox',
options:{
url:'combobox_provincia.php',
valueField:'idprovincia',
textField:'siglaprovincia',
onChange:function(value){
var index = $(this).closest('tr.datagrid-row').attr('datagrid-row-index');
var ed = $('#tt').edatagrid('getEditor',{index:index,field:'comune'});
$(ed.target).combobox('reload','combobox_comuninew.php?prov='+value);
alert(value);
}
}
}
},
{field:'comune',title:'Comune',width:400,
editor:{
type:'combobox',
options:{
valueField:'idcomune',
textField:'nomecomune'
}
}
}
]]


I suppose I have to use formatter function for both columns but I don't understand how to implement the function with my code that uses edatagrid.
8  General Category / General Discussion / Chain Combo Inline editor (2) [Solved] on: August 16, 2013, 07:26:59 AM
Hi all,
I'm a newbie so sorry in advance for the probably silly question:

I've tried to use the code explained in the topic http://www.jeasyui.com/forum/index.php?topic=559.0 about the chained combobox (city/country) but I don't understand what is and how to use the parameter "idx" in:
Code:
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);

And how to pass in get_data.php the "value".

Thanks in advance.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!