Title: Combobox PROBLEM DISPLAY VALUE/TEXT (Loaded Values are OK) Post by: rannacher on July 27, 2015, 03:11:37 AM Please help, I dont get the combobox to display the selected value correctly.
See attached screenshot! When open all is fine, but the moment you select a value it has the special chars again. And thats regardless of what I do in the combobox <th data-options="field:'projectid',width:225, formatter:function(value,row){ var projectnamedecoded = mrrdecode(row.projectname); row.projectname = projectnamedecoded; //alert('formatter\n value=['+ value +']\n row='+ JSON.stringify(row) +']\n row.projectname='+row.projectname+']'); return row.projectname; }, editor:{ type:'combobox', options:{ valueField:'projectid', textField:'projectname', method:'get', url:'http://www.rannacher.com/_subdomain/engineers4you/includes/BO/load_existing_projects.php?mandant=HHMZT', required:true, onSelect: function(row){ var projectnamedecoded = mrrdecode(row.projectname); row.projectname = projectnamedecoded; //$(this).combobox('setValue', row.projectname ); return row; }, onChange: function(row) { //alert('onChange Combo'+row); } } }">Projekt</th> Please help me. Thx in advance! Title: Re: Combobox PROBLEM DISPLAY VALUE/TEXT (Loaded Values are OK) Post by: stworthy on July 27, 2015, 07:00:38 PM Here is the data returned from your URL.
Code: [{"ID":"2050","NAME":"15001-Universumstrasse 48","projectid":"2050","projectname":"15001-Universumstrasse 48"},{"ID":"2051","NAME":null,"projectid":"2051","projectname":"15002-Diverse Geschäftsfälle"}] Please modify your 'load_existing_projects.php' to return the correct data. Another way to solve this issue is to use the 'loadFilter' function to convert your data to the correct format. Code: editor:{ Title: Re: Combobox PROBLEM DISPLAY VALUE/TEXT (Loaded Values are OK) Post by: rannacher on July 28, 2015, 03:08:25 AM FIRST OF ALL - Your loadFilter WORKS like a charm, THX A LOT!
Just for better understanding and consequent future use to avoid problems: I tried your first proposed solution and actually my data gets masked on php side. If I dont mask it then it is not displayed at all in combobox - appearance then is a smaller sized blanc row when opening the combobox (u may try "Geschäftsfälle"). For that I use : Code (sorry dont know how to insert elegantly like your tagged code): //PHP Code: while($row = mysqli_fetch_assoc($result)) { $row['projectid']= $row['ID']; $row['projectname']= umlaute($row['NAME']); $row_set[] = $row; } function umlaute($text) { $returnvalue=""; for($i=0;$i<strlen($text);$i++){ $teil=hexdec(rawurlencode(substr($text, $i, 1))); if($teil<32||$teil>1114111){ $returnvalue.=substr($text, $i, 1); }else{ $returnvalue.="&#".$teil.";"; } } return $returnvalue; } // client/javascript - I use for decoding - which works fine but I just DID NOT COMBINE IT WITH LOADFILTER function mrrdecode(str) { var dummy = document.createElement('textarea'); dummy.innerHTML = str; return dummy.value; } Accordingly if I open the url stated url:'http://www.rannacher.com/_subdomain/engineers4you/includes/BO/load_existing_projects.php?mandant=HHMZT' I DONT get any of these special chars, like you printed. FFirst things I tested when debugging. Not in chrome not in IE etc.??? Any idea? |