📄 index.js
字号:
.setHeight(90) .setCaption("Notes") ); host.group1.append((new linb.UI.TextEditor) .host(host,"texteditor8") .setDock("fill") .setDockMargin({"left":0, "top":0, "right":0, "bottom":3}) .setPosition("relative") ); host.block6.append((new linb.UI.Panel) .host(host,"dialog14") .setLeft(0) .setTop(0) .setCaption("Customers") .setImage("img/customer.gif") ); host.dialog14.append((new linb.UI.Tabs) .host(host,"tabs2") .setItems([{"id":"a", "caption":"Customer", "tips":"Customer Info"}, {"id":"b", "caption":"Order Summary & Details", "tips":"Order Info"}]) .setDockMargin({"left":4, "top":4, "right":4, "bottom":4}) .setLeft(0) .setTop(0) .setValue("a") ); host.tabs2.append((new linb.UI.Label) .host(host,"label43") .setLeft(330) .setTop(50) .setWidth(110) .setCaption("Phone Number") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label51") .setLeft(20) .setTop(250) .setWidth(110) .setCaption("Shipments Address:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label52") .setLeft(20) .setTop(140) .setWidth(110) .setCaption("Bill Address:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label45") .setLeft(330) .setTop(110) .setWidth(110) .setCaption("Notes:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label46") .setLeft(330) .setTop(80) .setWidth(110) .setCaption("Fax Number:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label44") .setLeft(20) .setTop(20) .setWidth(110) .setCaption("Company Name:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label48") .setLeft(20) .setTop(110) .setWidth(110) .setCaption("Email:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label47") .setLeft(330) .setTop(20) .setWidth(110) .setCaption("Web Site:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label49") .setLeft(20) .setTop(80) .setWidth(110) .setCaption("Last Name:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Label) .host(host,"label50") .setLeft(20) .setTop(50) .setWidth(110) .setCaption("First Name:") .setHAlign("left") , 'a'); host.tabs2.append((new linb.UI.Group) .host(host,"group7") .setLeft(10) .setTop(10) .setWidth(600) .setHeight(150) .setCaption("Orders - Double Click Row Header To See Details") , 'b'); host.group7.append((new linb.UI.TreeGrid) .host(host,"treegrid14") .setDockMargin({"left":4, "top":4, "right":4, "bottom":4}) .setHeader([{"id":"col1", "caption":"Order ID", "type":"input", "width":160}, {"id":"col4", "caption":"Ship Method", "type":"input", "width":100}, {"id":"col2", "caption":"Order Date", "type":"number", "format":"^-?\\d\\d*$", "width":100}, {"id":"col3", "caption":"Employee", "type":"number", "format":"^-?\\d\\d*$", "width":100}, {"id":"col5", "caption":"PO Name", "type":"number", "format":"^-?\\d\\d*$", "width":120}]) .setRows([]) .onDblClickRow("_treegrid14_ondblclickrow") ); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_email") .setLeft(140) .setTop(110) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_last_name") .setLeft(140) .setTop(80) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_company") .setLeft(140) .setTop(20) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_first_name") .setLeft(140) .setTop(50) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.TextEditor) .host(host,"tdt_customer_bill_addr") .setLeft(20) .setTop(160) .setWidth(280) .setHeight(70) , 'a'); host.tabs2.append((new linb.UI.TextEditor) .host(host,"texteditor19") .setLeft(330) .setTop(140) .setWidth(280) , 'a'); host.tabs2.append((new linb.UI.TextEditor) .host(host,"tdt_customer_ship_addr") .setLeft(20) .setTop(270) .setWidth(280) .setHeight(70) , 'a'); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_fax") .setLeft(440) .setTop(80) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_web") .setLeft(440) .setTop(20) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.Input) .host(host,"ipt_customer_phone") .setLeft(440) .setTop(50) .setWidth(170) , 'a'); host.tabs2.append((new linb.UI.Group) .host(host,"group8") .setLeft(10) .setTop(170) .setWidth(600) .setHeight(200) .setCaption("Order Details") , 'b'); host.group8.append((new linb.UI.TreeGrid) .host(host,"treegrid15") .setDockMargin({"left":4, "top":4, "right":4, "bottom":4}) .setHeader([{"id":"col1", "caption":"Product", "type":"input", "width":160}, {"id":"col4", "caption":"quantity", "type":"input", "width":100}, {"id":"col2", "caption":"Unit Price", "type":"number", "format":"^-?\\d\\d*$", "width":100}, {"id":"col3", "caption":"Discount", "type":"number", "format":"^-?\\d\\d*$", "width":100}, {"id":"col5", "caption":"Tatal Price", "type":"number", "format":"^-?\\d\\d*$", "width":120}]) .setRows([]) ); host.dialog14.append((new linb.UI.PageBar) .host(host,"pagebar11") .setLeft(20) .setTop(410) .setWidth(110) .setCaption("<font color=red>Click No To See Customers</font>") .setValue("1:1:4") .onClick("_pagebar11_onclick") ); return children; // ]]code created by jsLinb UI Builder }, _button9_onclick:function (profile, e, value) { this.dialog7.setZIndex(2); this.dialog14.setZIndex(1); }, _ajax1_onrequestok:function (response, rspType, threadId) { //linb.message(SPA); var obj = _.unserialize(response); SPA.global_data_order = obj; var idx = parseInt(SPA.tgd_orders_details.getTag())-1; SPA.tgd_orders_details.setRows(obj[idx].order_details); SPA.dbOrder.resetValue(obj[idx]); SPA._calculateTotal(obj[idx]); }, _ajax2_onrequestok:function (response, rspType, threadId) { //linb.message(SPA); var obj = _.unserialize(response); var a = SPA.pagebar11.getValue().split(':'); var idx = a[1]-1; SPA._bindCustomerData(obj[idx]); SPA._bindOrdersDataByCustomer(obj[idx].company_name); }, _load1:function(key){ if(SPA.$v1==key)return; SPA.$v1=key; var ns=this; ns.tgd_orders_details.setTag(key); linb.Thread.observableRun(function(threadid){ linb.Ajax('Data/Orders.js','rnd=' + Math.random(),ns._ajax1_onrequestok,null,threadid).start(); }); }, _pagebar1_onclick:function (profile, page) { profile.boxing().setPage(page); this._load1(page); }, _onReady:function(page, threadid){ SPA = page; }, events:{"onReady":"_onReady", "onRender":"_onrender"}, _button12_onclick:function (profile, e, value) { this.dialog7.show(); this.dialog14.hide(); SPA._load1(SPA.$v1||'1'); }, _button13_onclick:function (profile, e, value) { this.dialog7.hide(); this.dialog14.show(); SPA._load2(SPA.$v2||'1'); }, _bindCustomerData:function(obj){ //alert(this.cbi_orders_customer); this.ipt_customer_company.setValue(obj["company_name"]); this.ipt_customer_first_name.setValue(obj["first_name"]); this.ipt_customer_last_name.setValue(obj["last_name"]); this.ipt_customer_email.setValue(obj["email"]); this.ipt_customer_web.setValue(obj["web_site"]); this.ipt_customer_phone.setValue(obj["phone_number"]); this.ipt_customer_fax.setValue(obj["fax_number"]); this.tdt_customer_bill_addr.setValue(obj["bill_address"]); this.tdt_customer_ship_addr.setValue(obj["shipment_address"]); }, _bindOrdersDataByCustomer:function(custName){ //alert(SPA.global_data_order.length); var ar = new Array(); for(var i = 0; i < SPA.global_data_order.length;i++){ //alert(custName + " # " + SPA.global_data_order[i].customer); if(custName==SPA.global_data_order[i].customer){ ar.push({"id" : SPA.global_data_order[i].order_id, cells:[SPA.global_data_order[i].order_id, SPA.global_data_order[i].shipment,SPA.global_data_order[i].order_date, SPA.global_data_order[i].employee,SPA.global_data_order[i].po_number]}); } } SPA.treegrid14.setRows(ar); SPA.treegrid15.setRows([]); }, _calculateTotal:function(obj){ var t = 0.0; for(var i = 0;i<obj.order_details.length;i++){ t += obj.order_details[i].cells[1].value; } this.ipt_orders_subtotal.setValue(t); //ipt_orders_tax this.ipt_orders_total.setValue(t + this.ipt_orders_tax.getValue()); }, _load2:function(key){ if(SPA.global_data_customer){ var idx = parseInt(a[1]); SPA.tgd_orders_details.setRows(SPA.global_data_id[idx].order_details); SPA.dbOrder.resetValue(SPA.global_data_customer[idx]); this._calculateTotal(SPA.global_data_customer[idx]); }else{ var ns=this; linb.Thread.observableRun(function(threadid){ linb.Ajax('Data/Customers.js','rnd=' + Math.random(),ns._ajax2_onrequestok,null,threadid).start(); }); } }, _pagebar11_onclick:function (profile, page) { profile.boxing().setPage(page); this._load2(page); }, _treegrid14_ondblclickrow:function (profile, row, e, src) { for(var i = 0; i < SPA.global_data_order.length;i++){ //alert(custName + " # " + SPA.global_data_order[i].customer); if(row.id==SPA.global_data_order[i].order_id){ this.treegrid15.setRows(SPA.global_data_order[i].order_details); } } }, _onrender:function () { this._button12_onclick(); } }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -