Sigma Php Ajax framework, Ajax Components, GUI Builder
May 23, 2012, 09:10:08 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: ComboDroplist  (Read 1652 times)
Anthony
Full Member
***
Posts: 24


View Profile
« Reply #15 on: August 22, 2011, 02:11:30 AM »

Many many thanks

Anthony
Logged
Anthony
Full Member
***
Posts: 24


View Profile
« Reply #16 on: August 22, 2011, 03:42:18 AM »

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":""}]
Logged
linb
Administrator
Hero Member
*****
Posts: 435


View Profile
« Reply #17 on: August 22, 2011, 05:39:17 AM »

Class('App', 'linb.Com',{
    Instance:{
        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(67)
                .setTop(86)
                .setWidth(610)
                .setHeight(195)
                .setCaption("Find Patient")
                .setMinBtn(false)
                .setMaxBtn(false)
            );
           
            host.ctl_dialog1.append(
                (new linb.UI.ComboInput)
                .setHost(host,"ctl_comboinput5")
                .setLeft(60)
                .setTop(20)
                .setWidth(420)
                .setLabelSize(120)
                .setLabelCaption("by helpinput type")
                .setType("helpinput")
                .afterUIValueSet("_ctl_comboinput5_afteruivalueset")
            );
           
            host.ctl_dialog1.append(
                (new linb.UI.ComboInput)
                .setHost(host,"ctl_comboinput13")
                .setLeft(60)
                .setTop(100)
                .setWidth(420)
                .setLabelSize(120)
                .setLabelCaption("by costom drop window")
                .beforeComboPop("_ctl_comboinput13_beforecombopop")
            );
           
            host.ctl_dialog1.append(
                (new linb.UI.List)
                .setHost(host,"ctl_list4")
                .setLeft(60)
                .setTop(120)
                .setWidth(440)
                .setHeight(160)
                .setDisplay("none")
                .afterUIValueSet("_ctl_list4_afteruivalueset")
            );
           
            return children;
            // ]]code created by jsLinb UI Builder
        },
       
        loadCmb: function(){
            var ns=this,
                rspobj=[{"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":""}];
            ns.ctl_comboinput5.setItems(rspobj);
            ns.ctl_list4.setItems(rspobj);
        },
        _ctl_comboinput5_afteruivalueset : function (profile,oldValue,newValue){
            var ns = this, uictrl = profile.boxing();
            linb.log('------by helpinput type---------');
            linb.log(newValue);
            linb.log(profile.getItemByItemId(newValue));
        },
        events : {"onReady":"_com_onready"},
        _com_onready : function (com, threadid) {
            var ns=this;
            ns.loadCmb();
        },
        _ctl_comboinput13_beforecombopop : function (profile, pos, e, src) {
            var ns = this, uictrl = profile.boxing();
           
            ns.ctl_list4.afterUIValueSet(function(prf,oldValue, newValue){
                profile.boxing().setUIValue(newValue);
               
                linb.log('------by custom pop window---------');
                linb.log(newValue);
                linb.log(prf.getItemByItemId(newValue));
                node.hide();
            });
           
           
            var node=ns.ctl_list4.getRoot();
            node.popToTop(profile.getSubNode('BOX'));
            node.setBlurTrigger(profile.alias, function(){
                node.hide();
            });
       
        },
        _ctl_list4_afteruivalueset : function (profile, oldValue, newValue) {
            var ns = this, uictrl = profile.boxing();
        }
       
    }
});
Logged
Anthony
Full Member
***
Posts: 24


View Profile
« Reply #18 on: August 22, 2011, 07:09:26 AM »

Thank you

The selected text is not shown but this will do.

Thanks once again

Anthony
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!