diff --git a/o2web/source/x_component_portal_PageDesigner/Module/View/view.html b/o2web/source/x_component_portal_PageDesigner/Module/View/view.html index 6d1bdcf749ead52c5ac6984d714d122140d5a4dd..6cd187d378a4143737af096efbebd5de928d11ec 100644 --- a/o2web/source/x_component_portal_PageDesigner/Module/View/view.html +++ b/o2web/source/x_component_portal_PageDesigner/Module/View/view.html @@ -196,7 +196,7 @@
自定义过滤数据
- +
diff --git a/o2web/source/x_component_process_FormDesigner/Module/View/view.html b/o2web/source/x_component_process_FormDesigner/Module/View/view.html index 9232b29c9a5ce26547490217fa7cb280e6a48704..e95d6ef1e351d936d4bea4ca99f34af6eb77d678 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/View/view.html +++ b/o2web/source/x_component_process_FormDesigner/Module/View/view.html @@ -257,7 +257,7 @@
自定义过滤数据
- +
diff --git a/o2web/source/x_component_process_FormDesigner/Module/ViewSelector/ViewSelector.html b/o2web/source/x_component_process_FormDesigner/Module/ViewSelector/ViewSelector.html index fea53a143a2cbdb13c1a414a724e95a86ab8f613..e98d54dbd6f8001b9d09dfebfe4eddb4960b30a2 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/ViewSelector/ViewSelector.html +++ b/o2web/source/x_component_process_FormDesigner/Module/ViewSelector/ViewSelector.html @@ -107,6 +107,7 @@
+
diff --git a/o2web/source/x_component_process_Xform/View.js b/o2web/source/x_component_process_Xform/View.js index 7a70ede44076fc2ec1f8c054a1c2bc2f5bcac8b5..c593f080bd7a5bb63c630218582f2457aaaaf6c4 100644 --- a/o2web/source/x_component_process_Xform/View.js +++ b/o2web/source/x_component_process_Xform/View.js @@ -50,6 +50,8 @@ MWF.xApplication.process.Xform.View = MWF.APPView = new Class({ }.bind(this)); } + debugger; + //var data = JSON.parse(this.json.data); var viewJson = { "application": (this.json.queryView) ? this.json.queryView.appName : this.json.application, @@ -60,7 +62,8 @@ MWF.xApplication.process.Xform.View = MWF.APPView = new Class({ "itemStyles": this.json.itemStyles, "isExpand": this.json.isExpand || "no", "showActionbar" : this.json.actionbar === "show", - "filter": filter + "filter": filter, + "defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null }; //MWF.xDesktop.requireApp("query.Query", "Viewer", function(){ diff --git a/o2web/source/x_component_process_Xform/ViewSelector.js b/o2web/source/x_component_process_Xform/ViewSelector.js index 907a2776f2233ab1e439510e20874ddaa166c8af..8bbc75afd1994b09ad738613dbf38c315640a407 100644 --- a/o2web/source/x_component_process_Xform/ViewSelector.js +++ b/o2web/source/x_component_process_Xform/ViewSelector.js @@ -283,7 +283,8 @@ MWF.xApplication.process.Xform.ViewSelector = MWF.APPViewSelector = new Class({ "itemStyles": this.json.itemStyles, "isExpand": this.json.isExpand || "no", "showActionbar" : this.json.actionbar === "show", - "filter": filter + "filter": filter, + "defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null }; var options = {}; var width = options.width || "850"; diff --git a/o2web/source/x_component_query_Query/Viewer.js b/o2web/source/x_component_query_Query/Viewer.js index 4f08777db9e0b915ae620c8933c2b6d756742068..35b43341c409a5331de6ae8badb2b6a1b41e97af 100644 --- a/o2web/source/x_component_query_Query/Viewer.js +++ b/o2web/source/x_component_query_Query/Viewer.js @@ -191,7 +191,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({ this.createExportNode(); } }, - createViewNode: function(data){ + createViewNode: function(data, callback){ this.viewAreaNode.empty(); this.selectedItems = []; @@ -268,20 +268,20 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({ if (column.allowOpen) this.openColumns.push(column.column); }.bind(this)); - this.lookup(data); + this.lookup(data, callback); }else{ this.viewJson.selectList.each(function(column){ if (column.hideColumn) this.hideColumns.push(column.column); if (!column.allowOpen) this.openColumns.push(column.column); }.bind(this)); - this.lookup(data); + this.lookup(data, callback); } }, isSelectTdHidden :function(){ if( !this.viewJson.firstTdHidden ){ return false; } - if( this.json.select === "single" || this.json.select === "multi" ){ + if( this.json.select === "single" || this.json.select === "multi" || this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){ return false; } if( this.viewJson.select === "single" || this.viewJson.select === "multi" ){ @@ -391,7 +391,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({ this.currentPage = this.options.defaultPage || 1; this.options.defaultPage = null; }, - lookup: function(data){ + lookup: function(data, callback){ this.getLookupAction(function(){ if (this.json.application){ @@ -405,6 +405,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({ if( this.noDataTextNode )this.noDataTextNode.destroy(); this.loadCurrentPageData( function () { this.fireEvent("postLoad"); //用户配置的事件 + if(callback)callback(this); }.bind(this)); }else{ //this._loadPageNode(); @@ -424,6 +425,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({ this.loadingAreaNode = null; } this.fireEvent("postLoad"); //用户配置的事件 + if(callback)callback(this); } }.bind(this)); } @@ -1246,12 +1248,12 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({ }) } }, - setFilter : function( filter ){ + setFilter : function( filter, callback ){ if( !filter )filter = []; if( typeOf( filter ) === "object" )filter = [ filter ]; this.json.filter = filter; if( this.viewAreaNode ){ - this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null}); + this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null}, callback); } }, switchView : function( json ){ @@ -1381,6 +1383,27 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({ //} }.bind(this)); + //默认选中 + var defaultSelectedScript = this.view.json.defaultSelectedScript || this.view.viewJson.defaultSelectedScript; + if( !this.isSelected && defaultSelectedScript ){ + // var flag = this.view.json.select || this.view.viewJson.select || "none"; + // if ( flag ==="single" || flag==="multi"){ + // + // } + var flag = this.view.Macro.exec( defaultSelectedScript, + {"node" : this.node, "data" : this.data, "view": this.view, "row" : this}); + if( flag ){ + if( flag === "multi" || flag === "single" ){ + this.select( flag ); + }else if( flag.toString() === "true" ){ + var f = this.view.json.select || this.view.viewJson.select || "none"; + if ( f ==="single" || f==="multi"){ + this.select(); + } + } + } + } + // Object.each(this.data.data, function(cell, k){ // if (this.view.hideColumns.indexOf(k)===-1){ // var td = new Element("td", {"styles": this.css.viewContentTdNode}).inject(this.node); @@ -1587,8 +1610,8 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({ } }, - select: function(){ - var flag = this.view.json.select || this.view.viewJson.select || "none"; + select: function( force ){ + var flag = force || this.view.json.select || this.view.viewJson.select || "none"; if (this.isSelected){ if (flag==="single"){ this.unSelectedSingle(); diff --git a/o2web/source/x_component_query_ViewDesigner/$View/view.html b/o2web/source/x_component_query_ViewDesigner/$View/view.html index 56ca82c68ec57891a24d026af1e6ecf5a7bf9362..d0d2f41674ea9c0e0d4f8288d10f23243b28c679 100644 --- a/o2web/source/x_component_query_ViewDesigner/$View/view.html +++ b/o2web/source/x_component_query_ViewDesigner/$View/view.html @@ -117,6 +117,8 @@ +
+ diff --git a/o2web/source/x_component_query_ViewDesigner/Property.js b/o2web/source/x_component_query_ViewDesigner/Property.js index 3107382fc78e1c0fce46357230a5838b143b7160..61962d6fc1dea501d1931848bcfb759fabe06324 100644 --- a/o2web/source/x_component_query_ViewDesigner/Property.js +++ b/o2web/source/x_component_query_ViewDesigner/Property.js @@ -362,7 +362,14 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({ scriptAreas.each(function (node) { var title = node.get("title"); var name = node.get("name"); - var scriptContent = this.data[name]; + var names = name.split("."); + + var scriptContent = this.data; + Array.each(names, function (n) { + if (scriptContent) scriptContent = scriptContent[n]; + }); + + // var scriptContent = this.data[name]; MWF.require("MWF.widget.ScriptArea", function () { var scriptArea = new MWF.widget.ScriptArea(node, { @@ -370,7 +377,16 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({ //"maxObj": this.propertyNode.parentElement.parentElement.parentElement, "maxObj": this.designer.editContentNode, "onChange": function () { - this.data[name] = scriptArea.toJson().code; + + var scriptObj = this.data; + Array.each(names, function (n, idx) { + if( idx === names.length -1 )return; + if (scriptObj) scriptObj = scriptObj[n]; + }); + + scriptObj[names[names.length -1]] = scriptArea.toJson().code; + + // this.data[name] = scriptArea.toJson().code; }.bind(this), "onSave": function () { this.designer.saveView();