Show Posts
|
Pages: 1 [2] 3 4 ... 6
|
16
|
General Category / EasyUI for jQuery / Re: Combogrid cannot read property 'idField' of null
|
on: February 22, 2017, 01:27:18 AM
|
Hi, thanks for the support! This is the html code of the form : <form id="search_samplePatient"> <div> <label>Search the patient using the protocol number and/or sample number and/or the biological sample type<br/><br/> <input id="cg_ricerca_paziente" style="width:250px" tabindex="10" class="easyui-validatebox" required="true"></input> </label> </div> <div> <input type="button" name="Send" value="Search" tabindex="20" onclick="javascript: loadDataQtaSample($('#tt_modifica_qta_sample').tabs('getTabIndex',$('#tt_modifica_qta_sample').tabs('getSelected')));" tabindex="20"> </div> </form> <div class="easyui-tabs" id="tt_modifica_qta_sample" > <!-- many tabs defined here --> <div title="DNA" style="padding:10px;" > <form id="dati_dna" method="post"> <table> <tr><input type="hidden" name="dati_extra" value=""> <td>DNA quantity:</td> <td><input name="dna_num_vials_volume" type="text"></input></td> </tr> <tr> <td>DNA position:</td> <td><input id="dna_position" name="dna_position" style="width:150px"></input></td> </tr> <tr> <td>DNA sampling date:</td> <td><input name="sampling_date_dna_position" id="sampling_date_dna_position" class="easyui-datebox" type="text"></input></td> </tr> <tr> <td colspan="2"> <input type="button" name="Send" value="Modify" onclick="javascript: submitFormQtaSample(this.form);" > </td> </tr> </table> </form> </div> </div>
And this is my javascript code to load data in the form: <script type="text/javascript" language="javascript"> function myformatter(date){ var y = date.getFullYear(); var m = date.getMonth()+1; var d = date.getDate(); return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d); } function getParametersQtaSample(dati_ricerca,id_tab){ return 'controller/type_modifica_qta_campione_biologico.php?tab='+ id_tab +'&dati_ricerca='+ dati_ricerca; } function loadDataQtaSample(id_tab){ var data=''; var g = $('#cg_ricerca_paziente').combogrid('grid'); // get datagrid object var r = g.datagrid('getSelected'); // get the selected row switch(id_tab){ case 1: $('#sampling_date_dna_position').datebox({ formatter:myformatter, parser:myparser }); $('#dna_position').combogrid({ panelWidth:750, url: 'controller/search_stock_position.php', idField:'warehouse_number', textField:'warehouse_number', mode:'remote', fitColumns:true, columns:[[ {field:'warehouse_number',title:'Fridge number',width:250}, {field:'type_of_instrument',title:'Fridge',width:250}, {field:'placing',title:'Place',width:250}, ]] }); data=getParametersQtaSample(r.dati_ricerca,id_tab); $('#dati_dna').form('load', data); break; } } </script>
the getParametersQtaSample function call a php script that retrive the data after a specific query and return all by json array. The json array has the key value egual the name value defined in the input control form. The combogrid is preload when the webpage is loaded, then when i call $('#dati_dna').form('load', data) the combogrid select the right value defined in the json array. The problem is when the json array return null value, in the console of Chrome I've this error: Uncaught TypeError: Cannot read property 'warehouse_number' of null So my question is how i can manage this kind of situation?
|
|
|
17
|
General Category / EasyUI for jQuery / [SOLVED] Combogrid cannot read property 'idField' of null
|
on: February 21, 2017, 03:00:13 PM
|
Hello to all, i've this combogrid: $('#dna_position').combogrid({ panelWidth:750, url: 'controller/search_stock_position.php', idField:'warehouse_number', textField:'warehouse_number', mode:'remote', fitColumns:true, columns:[[ {field:'warehouse_number',title:'Fridge number',width:250}, {field:'type_of_instrument',title:'Fridge',width:250}, {field:'placing',title:'Place',width:250}, ]] }); This combo in used to load data in a form and the form load the data in this way: $('#dati_dna').form('load', data); The problem is: if i retrive data from server and no data for the combogrid i've this error: Uncaught TypeError: Cannot read property 'warehouse_number' of null So the question is: how i can solve it? there is a pre-check before to prevent this? Thanks for the help
|
|
|
19
|
General Category / Bug Report / TagBox and Enter Key
|
on: January 16, 2017, 02:02:35 PM
|
Hello to all, i want to report a particular bug, if it is, in tagbox: i read the Demo and try to use it : type a part of a word and I try to press the enter key to have the entire word searched. I mean: if I type "oran" and the tagbox display the entire word, if I press the "enter key" I want to see the entire work on tagbox, but nothing happened .
Can you explain if is possibile to do this?
Thanks in advance
|
|
|
22
|
General Category / EasyUI for jQuery / Re: Multiple Select on Combogrid like in Combobox
|
on: August 17, 2014, 06:51:22 AM
|
In the image attached you can see what happen if I try to search some elements. The combogrid show the other elements selected, but if you type a new one you have to remember to select the other elements, previously selected.
And if I try to search only one element and I try to press "Enter Key", the value searched is deleted.
|
|
|
24
|
General Category / EasyUI for jQuery / Re: Multiple Select on Combogrid like in Combobox
|
on: August 16, 2014, 07:30:49 AM
|
Yes I'm sorry stworthy
I want to implement a multiple select in a combogrid and retrive the data in remote mode.
So if the user select a first value and then write a second value , I want that the system display all possibile values (like a live search)
Your team developed a solutions for the Combobox called "Multiple select". In my previous post I show you what I did ...
I hope to have clarified what I want
|
|
|
26
|
General Category / EasyUI for jQuery / Re: How to do datagrid remote filter
|
on: August 15, 2014, 04:16:55 AM
|
I wanted to do datagrid with remote filter but I couldn't find any tutorial in the website. Can anyone help me? Thanks in advance.
This is my solution: 1. enable the remote filter. After this u have to setup ur server side code to accept this new mode. $('#laboratory_results').datagrid({ url: getParameters(), remoteFilter:true });
nb: my getParameters() is a function that build the url with the header request 2. now u have to setup the filter in specific columns: a- field: the custom rule on. b- type: the filter type, possible values are: label,text,textarea,checkbox,numberbox,validatebox,datebox,combobox,combotree. c- options: the options of the filter type. d- op: the filter operation, possible values are: contains,equal,notequal,beginwith,endwith,less,lessorequal,greater,greaterorequal. The js code (this is my example) $('#laboratory_results').datagrid('enableFilter',[{ field:'type_of_result', type:'combobox', options:{ panelHeight:'auto', url:returnFilterValue(), onChange:function(value){ if (value == ''){ $('#laboratory_results').datagrid('removeFilterRule'); var cc = $('#risultati_laboratorio').datagrid('getFilterComponent', 'type_of_result'); cc.combobox('reload'); } else { $('#laboratory_results').datagrid('addFilterRule', { field: 'type_of_result', op: 'equal', value: value }); } $('#laboratory_results').datagrid('doFilter'); } } }, { field:'sample_number', type:'text', options:{precision:1}, op:['equal','beginwith'] }, { field:'genotype_old', type:'text', options:{precision:1}, op:['equal','beginwith'] }, { field:'genotype', type:'text', options:{precision:1}, op:['equal','beginwith'] }
]);
nb: returnFilterValue() is a js function that build an URL with some headers request, then the php return a groupped filter value 3- now u have to build a php script that take the filter value and then build a dynamic query to get the result $filterRules=array(); if (isset($_REQUEST['filterRules'])){ $filterRules=json_decode($_REQUEST['filterRules'],true); }
nb: the datagrid, after you call the method 'doFilter' send a request named 'filterRules' witch contain a json array Now u have to build a function that build ur filter query function filterQuery($filterArray,$table){
$num_filter=count($filterArray); #I start with 'AND because I've to attach the result at the master query $where=" AND "; $tmpdatafield = ""; for ($i=0; $i < $num_filter; $i++) {
$filterdatafield =$table."_analisys_to_perform.".$filterArray[$i]['field']; #field $filtervalue=$filterArray[$i]['value'];#value researched
# determined when I change filter field value if ($tmpdatafield == ""){ $tmpdatafield = $filterdatafield; } else if ($tmpdatafield <> $filterdatafield){ $where .= " AND "; }
#I build the filter query upon the filter value selected switch($filterArray[$i]['op']){ case 'contains'; $where .= $filterdatafield . " LIKE '%" . $filtervalue ."%'"; break; case 'equal'; $where .= $filterdatafield . " = '" . $filtervalue ."'"; break; case 'notequal'; $where .= $filterdatafield . " <> '" . $filtervalue ."'"; break; case 'beginwith'; $where .= $filterdatafield . " LIKE '" . $filtervalue ."%'"; break; case 'endwith'; $where .= $filterdatafield . " LIKE '%" . $filtervalue ."'"; break; case 'less'; $where .= $filterdatafield . " < " . $filtervalue ."'"; break; case 'lessorequal'; $where .= $filterdatafield . " <= " . $filtervalue ."'"; break; case 'greater'; $where .= $filterdatafield . " > " . $filtervalue ."'"; break; case 'greaterorequal'; $where .= $filterdatafield . " >= " . $filtervalue ."'"; break;
} $tmpdatafield = $filterdatafield;
} return $where; }
Hope this can be usefull for u and for other peoples... If stworthy want, can post my php function filterQuery in the documentation (please refer to my name)
|
|
|
27
|
General Category / EasyUI for jQuery / Multiple Select on Combogrid like in Combobox
|
on: August 14, 2014, 07:50:44 AM
|
Hello to all , Hello stworthy I'm trying to find a solution to have the multiple Select in a combogrid , but server side This is my solution but not work well: this is js $('#id_RS_to_search').combogrid({ panelWidth:500, url: 'controller/search_snp.php?protocol=<?php echo $_SESSION['protocol'] ?>', idField:'id_RS', textField:'id_RS', mode:'remote', multiple: true, fitColumns:true, columns:[[ {field:'ck',checkbox:true}, {field:'id_RS',title:'id_RS',width:250}, {field:'snp_name_lab',title:'snp_name_lab',width:250} ]] });
And this my php script if (isset($_REQUEST['protocol'])){
if (isset($_REQUEST['q']) && (!empty($_REQUEST['q']))){ $polimorfismi =$_REQUEST['q']); $array_polimorfismi=array(); $snp_app=''; $snp='';
#controllo se ho piĆ¹ polimorfismi selezionati if (preg_match("/\,/", $polimorfismi)){ $array_polimorfismi=preg_split('/\,/',$polimorfismi);
$numero_polimorfismi_inseriti=count($array_polimorfismi); }else{ $numero_polimorfismi_inseriti=1; array_push($array_polimorfismi, $polimorfismi); } #genero in automatico le condizioni di ricerca for ($i=0;$i<=$numero_polimorfismi_inseriti;$i++){ if (!empty($array_polimorfismi[$i])){ $app=$array_polimorfismi[$i];//." ".$snp_name_lab; $snp_app= $snp_app." snps.id_RS LIKE '$app%' OR snps.snp_name_lab LIKE '$app%' OR "; $app=""; $snp_name_lab=""; } } $snp=substr($snp_app, 0, strlen($snp_app)-3);
$sql=" SELECT snps.id_RS, snps.snp_name_lab FROM snps ,snps_protocol WHERE snps_protocol.protocol='".$_REQUEST['protocol']."' AND snps_protocol.id_rs=snps.id_rs AND(".$snp.")"; #echo $sql; }else{ $sql=" SELECT snps.id_RS, snps.snp_name_lab FROM snps ,snps_protocol WHERE snps_protocol.protocol='".$_REQUEST['protocol']."' AND snps_protocol.id_rs=snps.id_rs "; #echo $sql; }
If I try to write two different value in the combogrid, using the ",", the result is that the combobox select only the last one... Or if I try to selcet one and then only write my value, the result is that I have only the first value selected Can u help me? Thanks
|
|
|
|