Show Posts
|
|
Pages: [1]
|
|
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: <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 
|
|
|
|
|
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 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.
|
|
|
|
|
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: 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: 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.
|
|
|
|
|