Hi linb
Sorry not quite correct.
By having setting the conmbo Type to Listbox I am unable to enter any filtered string.
The senerio is this. I have a list of 10,000 patients I enter a few letters of the surname I click the dropdown a small list of about 150 names appear, I select one from the list.
I get this far but the newValue it the caption and using profile.getItemByItemId(newValue) simply returns a null
Please help
Anthony
Thanks
// The default code is a com class (inherited from linb.Com)
//Class('App.Findpat', 'linb.Com',{
Class('App', 'linb.Com',{
// Ensure that all the value of "key/value pair" does not refer to external variables
Instance:{
// To initialize instance(e.g. properties)
initialize : function(){
// To determine whether or not the com will be destroyed, when the first UI control be destroyed
this.autoDestroy = true;
// To initialize properties
this.properties = {};
},
customAppend:function(){
this.dialog.show();
},
// To initialize internal components (mostly UI controls)
// *** If you're not a skilled, dont modify this function manually ***
iniComponents : function(){
// [[code created by jsLinb UI Builder
var host=this, children=[], append=function(child){children.push(child.get(0))};
append(
(new linb.UI.Dialog)
.setHost(host,"ctl_dialog1")
.setLeft(130)
.setTop(70)
.setWidth(610)
.setHeight(420)
.setCaption("Find Patient")
.setMinBtn(false)
.setMaxBtn(false)
);
host.ctl_dialog1.append(
(new linb.UI.Button)
.setHost(host,"ctl_button5")
.setLeft(470)
.setTop(150)
.setWidth(90)
.setHeight(40)
.setCaption("<h1>Close</h1>")
.onClick("_ctl_button5_onclick")
);
host.ctl_dialog1.append(
(new linb.UI.Label)
.setHost(host,"ctl_label30")
.setLeft(220)
.setTop(248)
.setWidth(130)
.setCaption("<font color=\"Green\" size=\"3\">Find Patient</font>")
.setHAlign("left")
);
host.ctl_dialog1.append(
(new linb.UI.RadioBox)
.setHost(host,"ctl_radiobox3")
.setItems([{"id":"1", "caption":"Name:"}, {"id":"2", "caption":"DOB:"}, {"id":"3", "caption":"Patient No:"}, {"id":"4", "caption":"postcode:"}, {"id":"5", "caption":"known As:"}])
.setLeft(80)
.setTop(310)
.setWidth(430)
.setHeight(40)
.setBorderType("outset")
.setValue("a")
.onItemSelected("_ctl_radiobox3_onitemselected")
);
host.ctl_dialog1.append(
(new linb.UI.Group)
.setHost(host,"ctl_group37")
.setLeft(70)
.setTop(30)
.setWidth(380)
.setHeight(160)
.setCaption("")
.setToggleBtn(false)
);
host.ctl_group37.append(
(new linb.UI.Input)
.setHost(host,"txt_patid")
.setLeft(12)
.setTop(30)
.setWidth(348)
.setLabelSize(120)
.setLabelCaption("Patient Number:")
);
host.ctl_group37.append(
(new linb.UI.Input)
.setHost(host,"txt_PatName")
.setLeft(12)
.setTop(66)
.setWidth(348)
.setLabelSize(120)
.setLabelCaption("Name:")
);
host.ctl_group37.append(
(new linb.UI.Input)
.setHost(host,"txt_PatDOB")
.setLeft(12)
.setTop(100)
.setWidth(348)
.setLabelSize(120)
.setLabelCaption("D.O.B:")
);
host.ctl_group37.append(
(new linb.UI.SLabel)
.setHost(host,"ctl_slabel9")
.setLeft(150)
.setTop(0)
.setWidth(164)
.setHeight(20)
.setCaption("Patient Details")
.setHAlign("center")
);
host.ctl_dialog1.append(
(new linb.UI.Label)
.setHost(host,"ctl_label68")
.setLeft(20)
.setTop(218)
.setWidth(570)
.setCaption("<hr size=\"3\" align=\"left\" width=\"560\" color=\"lightgray\">")
);
host.ctl_dialog1.append(
(new linb.UI.ComboInput)
.setHost(host,"ctl_comboinput5")
.setLeft(80)
.setTop(280)
.setWidth(420)
.setLabelCaption("ctl_comboinput5")
.afterUIValueSet("_ctl_comboinput5_afteruivalueset")
);
return children;
// ]]code created by jsLinb UI Builder
},
// Give a chance to load other com
iniExComs : function(com, threadid){
},
// Give a chance to determine which UI controls will be appended to parent container
customAppend : function(parent, subId, left, top){
// "return false" will cause all the internal UI controls will be added to the parent panel
return false;
},
// This instance's events
events : {},
_ctl_button5_onclick : function (profile,e,src,value){
var ns = this, uictrl = profile.boxing();
ns.ctl_dialog1.close();
},
loadCmb: function(){
var ns = this;
var url = "
http://10.10.8.6/jslinb/visualjs/projects/gpsurgery/backend/php/patfind.php";
// var params = {sname:ns.ctl_comboinput5.getUIValue() ,sw:window.FP17Info.PatFind , rnd:Math.random() * 1000};
var params = {sname:ns.ctl_comboinput5.getUIValue() ,sw:1 , rnd:Math.random() * 1000};
linb.request(url,
params,
function(rsp){
var rspobj = typeof rsp=="string"?_.unserialize(rsp):rsp;
if(rspobj){
// handle result
ns.ctl_comboinput5.setItems(rspobj);
}else{
// handle exception
linb.alert("Error1");
}
}, function(rsp){
// handle exception
linb.alert("Error2");
});
},
_ctl_comboinput5_afteruivalueset : function (profile,oldValue,newValue){
var ns = this, uictrl = profile.boxing();
ns.loadCmb();
linb.log(newValue);
linb.log(profile.getItemByItemId(newValue));
},
_ctl_radiobox3_onitemselected : function (profile,item,e,src,type){
var ns = this, uictrl = profile.boxing();
/*
App._JJ(item.id);
// ns.ctl_comboinput5.setDisabled(false);
ns.ctl_comboinput5.setUIValue("");
ns.ctl_comboinput5.setValue("");
*/
}
}
});
Sample Patient list
[{"id":" 950","caption":"ANDERSON FORENAME 05-10-1945 15 Address Road"},{"id":" 1629","caption":"Andersson FORENAME 12-12-1978 Paul Jones and Associates"},{"id":" 105","caption":"ANGLADE FORENAME 23-09-1935 30 Address Road"},{"id":" 2366","caption":"ANDREWS FORENAME 23-11-1952 49 Address Street"},{"id":" 2921","caption":"ANDERSON FORENAME 16-03-1950 9 Address Drive"},{"id":" 3140","caption":"ANDREWS FORENAME 05-03-1937 6 Address View"},{"id":" 3363","caption":"ANDREWS FORENAME 03-03-1936 47A Address Road"},{"id":" 4012","caption":"ANDREWS FORENAME 23-08-1947 Address "},{"id":" 4252","caption":""},{"id":" 4270","caption":"ANDREWS FORENAME 28-04-1935 1 Address Tree Close"},{"id":" 4427","caption":"ANGEL FORENAME 22-02-1962 105 Address Road"},{"id":" 5180","caption":"ANDREWS FORENAME 21-01-1946 Address"},{"id":" 5542","caption":"ANDERSON FORENAME 30-07-1932 14A Address House"},{"id":" 5923","caption":"ANDREWS FORENAME 20-11-1975 59 Address Gardens"},{"id":" 6091","caption":"ANDERSON FORENAME 15-12-1945 28 Address Avenue"},{"id":" 6258","caption":"ANDERSON FORENAME 24-07-1937 35 Old Address Road"},{"id":" 6770","caption":"ANTEN DONNA (P61 & IN Address) 07-12-1961 12 St Peters Close"},{"id":" 7503","caption":"ANTHONY-KAY SHANAAZ 20-06-1978 15 Trinity Road"},{"id":" 8030","caption":"ANDERSON FORENAME 30-09-1961 5 Upper Address Road"},{"id":" 8175","caption":"ANNIS/KITCHENER FORENAME 03-03-2001 5 Address Leys"},{"id":" 8366","caption":"ANTHONY FORENAME 08-08-1968 48 Address Road"},{"id":" 9464","caption":""}]