龙博databinder类绑定远程数据源

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.DataBinder)
                .setHost(host,"databinder_json")
                .setDataSourceType("remoting")
                .setQueryURL("http://ajax.googleapis.com/ajax/services/search/web")
                .setQueryArgs({"v":"1.0", "q":"jsLinb"})
                .setName("databinder_json")
                .afterRead("_databinder_1_afterread")
            );
            
            append(
                (new linb.DataBinder)
                .setHost(host,"databinder_xmlrpc")
                .setDataSourceType("remoting")
                .setQueryURL("../../../backend/test/rpc/server.php")
                .setRequestType("XML")
                .setResponseType("XML")
                .setQueryArgs({"methodName":"passThrough", "params":[2790, 1290320.2323, null, "Hello world ☺", "Hello world2", new Date(2011,4,9,18,4,15,586), {"Color":"Red", "Truth":true}, [1, 2, 3, 4]]})
                .setName("databinder_xmlrpc")
                .afterRead("_databinder_xmlrpc_afterread")
            );
            
            append(
                (new linb.DataBinder)
                .setHost(host,"databinder_soap")
                .setDataSourceType("remoting")
                .setQueryURL("../../../backend/test/soap/soap.php")
                .setRequestType("SOAP")
                .setResponseType("SOAP")
                .setQueryArgs({"methodName":"getUserInfo", "params":{"bgin":"3", "limit":"323"}})
                .setName("databinder_soap")
                .afterRead("_databinder_soap_afterread")
            );
            
            append(
                (new linb.DataBinder)
                .setHost(host,"databinder_7")
                .setDataSourceType("remoting")
                .setQueryURL("http://127.0.0.1/gdzc/php/login.php")
                .setQueryMethod("POST")
                .setQueryArgs({"username":"李伟", "password":"cf79ae6addba60ad018347359bd144d2"})
                .setName("databinder_7")
                .afterRead("_databinder_7_afterread")
            );
            
            append(
                (new linb.UI.Group)
                .setHost(host,"ctl_group1")
                .setLeft(40)
                .setTop(40)
                .setWidth(650)
                .setHeight(80)
                .setCaption("DataBinder for <strong>google search API (JSON service)</strong>")
                .setToggleBtn(false)
            );
            
            host.ctl_group1.append(
                (new linb.UI.SLabel)
                .setHost(host,"ctl_slabel3")
                .setLeft(30)
                .setTop(24)
                .setWidth(124)
                .setCaption("results count :")
            );
            
            host.ctl_group1.append(
                (new linb.UI.SLabel)
                .setHost(host,"ctl_slabel4")
                .setLeft(310)
                .setTop(24)
                .setWidth(124)
                .setCaption("the top url is :")
            );
            
            host.ctl_group1.append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input1")
                .setDataBinder("databinder_json")
                .setDataField("returnurls")
                .setLeft(180)
                .setTop(20)
                .setLabelCaption("ctl_input1")
            );
            
            host.ctl_group1.append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input11")
                .setDataBinder("databinder_json")
                .setDataField("topurl")
                .setLeft(440)
                .setTop(20)
                .setLabelCaption("ctl_input1")
            );
            
            append(
                (new linb.UI.Group)
                .setHost(host,"ctl_group15")
                .setLeft(40)
                .setTop(140)
                .setWidth(650)
                .setHeight(80)
                .setCaption("DataBinder for local <strong>XMLRPC service</strong>")
                .setToggleBtn(false)
            );
            
            host.ctl_group15.append(
                (new linb.UI.SLabel)
                .setHost(host,"ctl_slabel33")
                .setLeft(30)
                .setTop(24)
                .setWidth(124)
                .setCaption("result 1 :")
            );
            
            host.ctl_group15.append(
                (new linb.UI.SLabel)
                .setHost(host,"ctl_slabel34")
                .setLeft(310)
                .setTop(24)
                .setWidth(124)
                .setCaption("result 2 :")
            );
            
            host.ctl_group15.append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input20")
                .setDataBinder("databinder_xmlrpc")
                .setDataField("r1")
                .setLeft(180)
                .setTop(20)
                .setLabelCaption("ctl_input1")
            );
            
            host.ctl_group15.append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input21")
                .setDataBinder("databinder_xmlrpc")
                .setDataField("r2")
                .setLeft(440)
                .setTop(20)
                .setLabelCaption("ctl_input1")
            );
            
            append(
                (new linb.UI.Group)
                .setHost(host,"ctl_group26")
                .setLeft(40)
                .setTop(240)
                .setWidth(650)
                .setHeight(80)
                .setCaption("DataBinder for local <strong>SOAP service</strong>")
                .setToggleBtn(false)
            );
            
            host.ctl_group26.append(
                (new linb.UI.SLabel)
                .setHost(host,"ctl_slabel55")
                .setLeft(30)
                .setTop(24)
                .setWidth(124)
                .setCaption("user :")
            );
            
            host.ctl_group26.append(
                (new linb.UI.SLabel)
                .setHost(host,"ctl_slabel56")
                .setLeft(310)
                .setTop(24)
                .setWidth(124)
                .setCaption("msg :")
            );
            
            host.ctl_group26.append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input42")
                .setDataBinder("databinder_soap")
                .setDataField("user")
                .setLeft(180)
                .setTop(20)
                .setLabelCaption("ctl_input1")
            );
            
            host.ctl_group26.append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input43")
                .setDataBinder("databinder_soap")
                .setDataField("msg")
                .setLeft(440)
                .setTop(20)
                .setLabelCaption("ctl_input1")
            );
            
            append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input40")
                .setDataBinder("databinder_7")
                .setDataField("success")
                .setLeft(220)
                .setTop(340)
                .setLabelCaption("ctl_input40")
                .setValue("true")
            );
            
            append(
                (new linb.UI.Input)
                .setHost(host,"ctl_input41")
                .setDataBinder("databinder_7")
                .setDataField("deptname")
                .setLeft(500)
                .setTop(340)
                .setLabelCaption("ctl_input41")
            );
            
            append(
                (new linb.UI.SButton)
                .setHost(host,"ctl_sbutton5")
                .setLeft(320)
                .setTop(410)
                .setWidth(130)
                .setCaption("ctl_sbutton5")
                .onClick("_ctl_sbutton5_onclick")
            );
            
            return children;
            // ]]code created by jsLinb UI Builder
        },
        _databinder_1_afterread : function (profile, rspData) {
            var rst=_.get(rspData,["responseData","results"]);
            
            return {
                returnurls:rst.length,
                topurl:rst[0].url
            };
        },
        _databinder_xmlrpc_afterread : function (profile, rspData) {
            return {
                r1: rspData.result[0],
                r2: rspData.result[3]
            };
        },
        _databinder_soap_afterread : function (profile, rspData) {
            return rspData.result;
        },
        _databinder_7_afterread : function (profile,rspData){
            var ns = this, uictrl = profile.boxing();
              return {
                success:rspData.success,//返回的成功标志
                deptname:rspData.info.deptname//返回的授权部门
            }
                },
        _ctl_sbutton5_onclick : function (profile,e,src,value){
            var ns = this, uictrl = profile.boxing();
            this.databinder_7.setQueryArgs({
                "username" : "王强",
                "password" : "cf79ae6addba60ad018347359bd144d2"
            } ,true);//重设登录用户名及密码参数
            this.databinder_7.read();//调用Read重新从服务器读数据
          
        }
    }
});

jsLINB是一个完全的浏览器端javascript解决方案,兼容大部分现代浏览器 (IE6.0/IE7.0/firefox1.5/firefox2.0/opera9/Safari2.0,Safari缺乏测试)。它可以帮助程序开发者实现各种型的RIA应用-在提供更加强大框架的同时更加易用。压缩的核心代码仅仅50k,包括了javascript型检查,强制型,精密且灵活的事件模型,自定义事件,observer和tie/untie,boxing/unBoxing/reBoxing模型,直接调用,dom生成,查询,遍历和操作,css样式操作,css操作,dom属性操作,javascript完美OO实现,javascript线程,高级Ajax,强大的DragDrop,超级控件(可在外观/模板/行为/数据模型四个维度上定制的标准控件,可完全自定义控件)等。 jsLinb is a Cross-Browser javascript framework with cutting-edge functionality for rich web application. • Rich client-side API, works with any backend (php, .Net, Java, python) or static HTML pages. • More then 40 common components, including Tabs, Dialog, TreeGrid, TimeLine and many other web GUI components. • Wide cross-browser compatibility, IE6+, firefox1.5+, opera9+, safari3+ and Google Chrome. • Full API Documentation with tons of samples. • Ever Increasing Code Snippets. • Drag&Drop GUI builder and IDE available, what you see is exactly what you get. Significantly reduced development time. • Compatible with jQuery, prototype, mootools and other frameworks. • Open Source under LGPL license, and commercial support available.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值