How to load list of ComboInput dynamically

Find code here before you post.

How to load list of ComboInput dynamically

Postby linb » Thu May 30, 2013 3:40 am

   
Class('App', 'xui.Com',{
Instance:{
autoDestroy:true,
iniComponents:function(){
// [[Code created by CrossUI RAD Tools
var host=this, children=[], append=function(child){children.push(child.get(0))};

append(
(new xui.UI.ComboInput)
.setHost(host,"comboinput2")
.setLeft(70)
.setTop(30)
.setType("listbox")
.beforeComboPop("_comboinput2_beforecombopop")
);

return children;
// ]]Code created by CrossUI RAD Tools
},

_comboinput2_beforecombopop:function (profile, pos, e, src) {
var prop=profile.properties;
if(prop.items.length==0){
// Set face
profile.boxing().setItems([{id:"Loading...", capiton:"Loading...", disabled:true}]);
// // Try to get from cache first
// var picklist = xxx.getFromCache...
// if(picklist){
// profile.boxing().setItems(picklist);
// }else{
// xui.request(xxx,{xxx},function(rsp){
// if(rsp){
// var items=[];
// // set to cache
// xxx.setCache...;
// // set data to comboInput
// profile.boxing().setItems(items);
// }else{
// // if it's fail, collapse it
// profile.boxing().setItems([]).collapse();
// }
// },function(){
// // if it's fail, collapse it
// profile.boxing().setItems([]).collapse();
// });
//}

// To simulate Ajax
_.asyRun(function(){
profile.boxing().setItems([{id:'a',caption:'item a'},{id:'b',caption:'item b'}]);
},500);
}
}
}
});
   
linb
Site Admin
 
Posts: 102
Joined: Thu Apr 25, 2013 6:51 am

Return to CrossUI Code Snaps

Who is online

Users browsing this forum: No registered users and 1 guest

cron