动态添加和更改F7编辑器(div和editGrid列)

 1 //更改列编辑器
 2         waf("#editGrid").wafGrid("setColumnConfig", "settlementType",
 3              {
 4                   edittype:"f7",
 5                   editoptions:{
 6                        /**这里填写wafctrl:promptBox中的属性和值,是一个JSON对象**/
 7                           f7Json:{displayFormat:"{name}"},
 8                        /**这里填写wafPromptQuick、wafPromptGrid、wafPromptIframe中的一个**/
 9                        subWidgetName:"wafPromptQuick",
10                           /**这里填写wafctrl:promptQuick、wafctrl:promptGrid、wafctrl:
11                           promptIframe中的属性和值,是一个JSON对象**/
12                        subTagJson:{query:"com.kingdee.eas.basedata.assistant.app.SettlementTypeQuery",dataUrl:waf.
13                                    getContextPath()+"/component/F7Quick.do?method=initalize",numberOfContent: [10, 1],width:280},
14                           /**这里填写wafctrl:validator中的属性和值,是一个JSON对象**/
15                        validateJson:{errMsg:"required:'名称不能为空!'", rules:"required:true"},
                onchange:_private.settlementTypeChange
16 }, 17 formatter:"f7" 18 } 19 );
1 //设置列过滤条件
2 waf("#editGrid").wafGrid("setCellEditorAllConfig","revAccount","filteritem","companyID.id='"+currentCompanyId+"'","promptQuick",null);
3 //设置allowAutoComplete和autoCompleteItem属性,捕获到F7有键盘输入时触发onkeypress事件
4 waf("#editGrid").wafGrid("setCellEditorAllConfig","revAccount","allowAutoComplete",true,"promptQuick",null);
5 waf("#editGrid").wafGrid("setCellEditorAllConfig","revAccount","autoCompleteItem","name","promptQuick",null);

 1 //第二种方式,changeCellEditor更改某个单元格的编辑器
 2 var options={
 3      edittype:"f7",
 4      editoptions:{
 5             /**这里填写wafctrl:promptBox中的属性和值,是一个JSON对象**/
 6              f7Json:{displayFormat:"{name}"},
 7             /**这里填写wafPromptQuick、wafPromptGrid、wafPromptIframe中的一个**/
 8             subWidgetName:"wafPromptQuick",
 9               /**这里填写wafctrl:promptQuick、wafctrl:promptGrid、wafctrl:
10               promptIframe中的属性和值,是一个JSON对象**/
11             subTagJson:{query:"com.kingdee.eas.basedata.org.app.F7CUQuery",dataUrl:waf.
12                         getContextPath()+"/component/F7Quick.do?method=initalize"},
13               /**这里填写wafctrl:validator中的属性和值,是一个JSON对象**/
14             validateJson:{errMsg:"required:'名称不能为空!'", rules:"required:true"}
15       },
16      formatter:"f7"
17 }
18 waf("#list2").wafGrid("changeCellEditor", rowid, name, options);
 //动态向列布局添加F7
1
initCustomerF7:function(projectId){ 2 var name = "specialAgioCustomer"; 3 var filter = ""; 4 filter = "sellProject.id = '"+projectId+"'"; 5 var options = { 6 id:name, 7 name: name, 8 subWidgetName: "wafPromptQuick", 9 subWidgetOptions: { 10 url:"", 11 ajaxType: "GET", 12 query: "com.kingdee.eas.fdc.sales.app.SHECustomerQuery", 13 accessType: "remote", 14 isMulti:false, 15 allowAutoComplete: true, 16 autoChoose:false, 17 autoCompleteItem: "name,phone,simpleNamePingYin,fullNamePingYin,certificateNumber", 18 displayItem:"name", 19 onselect:_private.f7Customer_dataChanged, 20 cu: false, 21 filteritem:filter, 22 numberOfContent: [10, 1], 23 }, 24 formatter:_private.selectFormatter, 25 }; 26 var lbOptions = { 27 id: name + "Lb", 28 labelAlign: "right", 29 caption: "客户", 30 tagClass: "asstlb" 31 }; 32 33 var lbDOM = waf.createDOM("labelContainer", lbOptions); 34 waf.appendDOM(waf("#layoutCol2"), lbDOM); 35 waf.initComponent("labelContainer", lbOptions, lbDOM); 36 37 var promptBoxDom = waf.createDOM("promptBox", options); 38 waf("#"+name + "Lb").wafLabelContainer("append", promptBoxDom); 39 waf.initComponent("promptBox", options, promptBoxDom); 40 waf("#" + name + "Lb_ctrl .ui-f7-frame").css("width", "100%"); 41 },

 

posted @ 2016-10-25 15:03  suruozhong  阅读(662)  评论(0编辑  收藏  举报