How to use xui - 10 common examples

To help you get started, we’ve selected a few xui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linb / CrossUI / xui / js / DataBinder.js View on Github external
xui.arr.each(this.constructor._getBoundElems(prf),function(profile){
                if(!profile.box["xui.absValue"])return;
                var p=profile.properties,
                    ins = profile.boxing(),
                    // maybe return array
                    uv = ins.getUIValue(),
                    key = p.dataField || p.name || profile.alias, keys;
                // v and uv can be object(Date,Number)
                if(!dirtied || (uv+" ")!==(ins.getValue()+" ")){
                    if(ins.getCaption){
                        if(key.indexOf(":")!=-1){
                            keys=key.split(':');
                        }
                        if(keys && keys[0] && keys[1]){
                            hash[keys[0]]=uv;
                            hash[keys[1]]=ins.getCaption();
                        }else if(withCaption){
                            xui.set(hash,key,{
github linb / CrossUI / xui2.0 / xui / js / DataBinder.js View on Github external
xui.arr.each(this.constructor._getBoundElems(prf),function(profile){
                if(!profile.box["xui.absValue"])return;
                var p=profile.properties,
                    ins = profile.boxing(),
                    // maybe return array
                    uv = ins.getUIValue(),
                    key = p.dataField || p.name || profile.alias, keys;
                // v and uv can be object(Date,Number)
                if(!dirtied || (uv+" ")!==(ins.getValue()+" ")){
                    if(ins.getCaption){
                        if(key.indexOf(":")!=-1){
                            keys=key.split(':');
                        }
                        if(keys && keys[0] && keys[1]){
                            hash[keys[0]]=uv;
                            hash[keys[1]]=ins.getCaption();
                        }else if(withCaption){
                            hash[key]={
github linb / CrossUI / xui1.4 / xui / js / APICaller.js View on Github external
if(requestDataSource&&requestDataSource.length){
                for(var i in requestDataSource){
                    var o=requestDataSource[i],t;
                    switch(o.type){
                        case "databinder":
                            if(t = xui.DataBinder.getFromName(o.name)){
                                if(!t.updateDataFromUI()){
                                    return;
                                }else{
                                    if(o.path) _.set(queryArgs, o.path.split('.'),t.getData());
                                    else _.merge(queryArgs, t.getData(), 'without');
                                }
                            }
                            break;
                        case "form":
                            if((t = _.get(prf,["host",o.name])) && t.Class['xui.absContainer'] && t.getRootNode()){
                                if(!t.checkValid() || !t.checkRequired()){
                                    return;
                                }else{
                                    if(o.path)  _.set(queryArgs, o.path.split('.'), t.getFormValues());
                                    else _.merge(queryArgs, t.getFormValues(), 'without');
                                }
                            }
                            break;
                    }
                }
            }


            // Normally, Gives a change to modify "queryArgs" for XML
            if(prf.beforeInvoke && false===prf.boxing().beforeInvoke(prf, requestId))
                return;
github linb / CrossUI / xui2.0 / xui / js / APICaller.js View on Github external
for(var i in requestDataSource){
                    var o=requestDataSource[i],t,v,path;
                    switch(o.type){
                        case "databinder":
                            if(t = xui.DataBinder.getFromName(o.name)){
                                if(!t.updateDataFromUI()){
                                    return;
                                }else{
                                    path=(o.path||"").split('.');
                                    if(xui.isHash(v = xui.get(queryArgs, path)))xui.merge(v, t.getData(), 'without');
                                    else xui.set(queryArgs, path,t.getData());
                                }
                            }
                            break;
                        case "form":
                            if((t = xui.get(prf,["host",o.name])) && t.Class['xui.absContainer'] && t.getRootNode()){
                                if(!t.checkValid() || !t.checkRequired()){
                                    return;
                                }else{
                                    path=(o.path||"").split('.');
                                    if(xui.isHash(v = xui.get(queryArgs, path)))xui.merge(v, t.getFormValues(), 'without');
                                    else xui.set(queryArgs, path,t.getFormValues());
                                }
                            }
                            break;
                    }
                }
            }
            // the global handler
            if(xui.isFun(t1) && false===t1(requestId, prf))
                return;
            else if( xui.isHash(t1) && xui.isArr(t1.actions)
github linb / CrossUI / xui / js / APICaller.js View on Github external
for(var i in requestDataSource){
                    var o=requestDataSource[i],t,v,path;
                    switch(o.type){
                        case "databinder":
                            if(t = xui.DataBinder.getFromName(o.name)){
                                if(!t.updateDataFromUI()){
                                    return;
                                }else{
                                    path=(o.path||"").split('.');
                                    if(xui.isHash(v = xui.get(queryArgs, path)))xui.merge(v, t.getData(), 'without');
                                    else xui.set(queryArgs, path,t.getData());
                                }
                            }
                            break;
                        case "form":
                            if((t = xui.get(prf,["host",o.name])) && t.Class['xui.absContainer'] && t.getRootNode()){
                                if(!t.checkValid() || !t.checkRequired()){
                                    return;
                                }else{
                                    path=(o.path||"").split('.');
                                    if(xui.isHash(v = xui.get(queryArgs, path)))xui.merge(v, t.getFormValues(), 'without');
                                    else xui.set(queryArgs, path,t.getFormValues());
                                }
                            }
                            break;
                    }
                }
            }
            // the global handler
            if(xui.isFun(t1) && false===t1(requestId, prf))
                return;
            else if( xui.isHash(t1) && xui.isArr(t1.actions)
github linb / CrossUI / xui2.0 / xui / js / UI / FormLayout.js View on Github external
}
                    }

                    if(!inputPrf._attached2cell){
                        //console.log('afterappend',subId);
                        inputPrf._attached2cell = 1;
                        // for form field only
                        // prop and autoexpand
                        if(isFormField){
                            if(show){
                                inputPrf.locked = 1;
                                inputPrf.boxing().setDisplay('');
                                if(target.setLabelPos)  target.setLabelPos('none').setLabelCaption('').setLabelSize('0');
                                if(target.setVAlign)  target.setVAlign('middle');

                                if(target['xui.UI.Input'] 
                                    && target.getMultiLines && target.getMultiLines()
                                    && target.setAutoexpand
                                ){
                                    // use the hidden one: _autoexpand
                                    // once: set minH from subId
                                    if(!parseFloat(inputPrf._autoexpand)){
                                        // need set autoexpand in afterRowResize too
                                        inputPrf._autoexpand = (cell.offsetHeight()-1)+"px";
                                        inputPrf.getSubNode("INPUT").addClass("autoexpand");
                                        inputPrf.$beforeAutoexpand=function(p,h){
                                            h=target.getAutoexpandHeight();
                                            item._child_autoexpandH = h;
                                            if(prf.boxing()._isDesignMode()){
                                                // ensure to trigger table render once
                                                xui.resetRun(prf.getUid("autoex"), function(){
                                                    if(prf.$htable)prf.$htable.render();
github linb / CrossUI / xui1.3 / xui / js / UI / TreeBar.js View on Github external
p=profile.properties,
                            empty = sub===false;
                        //created
                        if(!empty&& !item._inited){
                            delete item.sub;
                            //before insertRows
                            item._inited=true;
                            if(sub){
                                if(typeof sub=='string')
                                    subNs.html(item.sub=sub,false);
                                else if(_.isArr(sub)){
                                    b.insertItems(sub, item.id,null,false,false);
                                    // for []
                                    if(!item.sub)item.sub=sub;                                    
                                }else if(sub['xui.Template']||sub['xui.UI']){
                                    subNs.append(item.sub=sub.render(true));
                                }
                                var s=0,arr=b.getUIValue(true);
                                if(arr && arr.length){
                                    _.arr.each(sub,function(o){
                                        if(_.arr.indexOf(arr, o.id||o)!=-1){
                                            s=1;
                                            return false;
                                        }
                                    });
                                    if(s){
                                        //set checked items
                                        profile._noScroll=1;
                                        b._setCtrlValue(b.getUIValue());
                                        delete profile._noScroll;
                                    }
                                }
github linb / CrossUI / xui1.4 / xui / js / UI / TreeBar.js View on Github external
var b=profile.boxing(),
                            p=profile.properties,
                            empty = sub===false;
                        //created
                        if(!empty&& !item._inited){
                            delete item.sub;
                            //before insertRows
                            item._inited=true;
                            if(sub){
                                if(typeof sub=='string')
                                    subNs.html(item.sub=sub,false);
                                else if(sub['xui.Template']||sub['xui.UI']){
                                    subNs.append(item.sub=sub.render(true));
                                }else if(_.isArr(sub)){
                                    b.insertItems(sub, item.id,null,false,false);
                                    // for []
                                    if(!item.sub)item.sub=sub;                                    
                                }
                                var s=0,arr=b.getUIValue(true);
                                if(arr && arr.length){
                                    _.arr.each(sub,function(o){
                                        if(_.arr.indexOf(arr, o.id||o)!=-1){
                                            s=1;
                                            return false;
                                        }
                                    });
                                    if(s){
                                        //set checked items
                                        profile._noScroll=1;
github linb / CrossUI / xui1.2 / xui / js / UI / TreeBar.js View on Github external
var b=profile.boxing(),
                                p=profile.properties,
                                empty = sub===false ||  (_.isArr(sub) && sub.length===0);
                            //created
                            if(!item._inited){
                                delete item.sub;
                                //before insertRows
                                item._inited=true;
                                if(sub){
                                    if(typeof sub=='string')
                                        subNs.html(item.sub=sub,false);
                                    else if(_.isArr(sub)){
                                        b.insertItems(sub, item.id);
                                        // for []
                                        if(!item.sub)item.sub=sub;                                    
                                    }else if(sub['xui.Template']||sub['xui.UI']){
                                        subNs.append(item.sub=sub.render(true));
                                    }
                                }
                                //set checked items
                                profile._innerSet=1;
                                b.setUIValue(b.getUIValue(), true);
                                delete profile._innerSet;
                            }

                            if(p.singleOpen)
                                b._toggleNodes(item._pid?profile.getItemByItemId(item._pid).sub:p.items, false)

                            var onend=function(){
                                subNs.css({display:'',height:'auto'});
                                markNode.removeClass('xui-ui-busy');
                                if(empty){
github linb / CrossUI / xui2.0 / xui / js / UI / TreeBar.js View on Github external
openSub = function(profile, item, id, markNode, subNs, barNode, icon, sub){
                        var b=profile.boxing(),
                            p=profile.properties,
                            empty = sub===false;
                        //created
                        if(!empty&& !item._inited){
                            delete item.sub;
                            //before insertRows
                            item._inited=true;
                            if(sub){
                                if(typeof sub=='string')
                                    subNs.html(item.sub=sub,false);
                                else if(sub['xui.Template']||sub['xui.UI']){
                                    subNs.append(item.sub=sub.render(true));
                                }else if(xui.isArr(sub)){
                                    b.insertItems(sub, item.id);
                                    // for []
                                    if(!item.sub)item.sub=sub;                                    
                                }
                                var s=0,arr=b.getUIValue(true);
                                if(arr && arr.length){
                                    xui.arr.each(sub,function(o){
                                        if(xui.arr.indexOf(arr, o.id||o)!=-1){
                                            s=1;
                                            return false;
                                        }
                                    });
                                    if(s){
                                        //set checked items