|
楼主 |
发表于 2017-5-8 17:20:36
|
显示全部楼层
本帖最后由 qweasdzxc 于 2017-5-8 17:45 编辑
第二次打开选择后,怎么把selectData里重复的数据删掉?- //返回的结果集
- Model.prototype.result = function(){
- var ret = [];
- var data = this.comp('selectData');
- data.each(function(p) {
- ret.push(p.row);
- });
- return ret;
- };
-
- //对话框返回数据
- Model.prototype.OKBtnClick = function(event){
- this.comp('wReceiver').windowEnsure(this.result());
- };
-
- //对话框打开检查是否选择存放位置
- Model.prototype.windowReceiverReceive = function(event){
- var _this=this;
- if(event.data.fLibraryId){
- var dialogData=this.comp("dialogData");
- dialogData.setFilter("filter2", "SAM_FacetTerm.fLibraryId='"+event.data.fLibraryId+"' or SAM_FacetTerm.fNodeType='facet' or (SAM_FacetTerm.fNodeType='term' and SAM_FacetTerm.fStatus='FB')");
- dialogData.refreshData();
- this.comp("treeGrid").expandAll();
- dialogData.first();
- }else{
- _this.comp("messageDialog").show({message : "没有选择存放位置!"});
- }
- var selectData=this.comp("selectData");
- alert(selectData.count());
- var treeGrid=this.comp("treeGrid");
- selectData.each(function(param){
- treeGrid.setRowChecked(param.row.val('fID'),true);
- });
- // if(selectData.count()>0){
- // this.comp("selectData").clear();
- // }
-
- };
-
- //控制树的选择
- Model.prototype.treeGridRowCheck = function(event){
- var _this=this;
- var checkedID = event.rowID;
- var fParent=null;
- if(event.row.val("fNodeType")==="term"){
- var params = new biz.Request.ActionParam();
- params.setString("checkedID", checkedID);
- biz.Request.sendBizRequest({
- "context" : this.getContext(),
- "action" : "checkTermAction",
- "parameters" : params,
- "directExecute" : true,
- "callback" : function(data) {
- if(data.state){
- fParent=data.response;
- }
- }
- });
- }
- var isChecked=false;
- var checkRows = event.source.getCheckedRows();
- for(var i=0;i<checkRows.length;i++){
- if(checkRows[i].row.SAM_FacetTerm.value.latestValue==fParent){
- isChecked=true;
- }
- }
- if(event.row.val("fNodeType")!="facet" && event.row.val("fNodeType")!="term"){
- event.cancel = true;
- _this.comp("messageDialog").show({message : "分类不可以选择!"});
- }else{
- if(event.row.val("fNodeType")==="term" && isChecked===false){
- event.cancel = true;
- _this.comp("messageDialog").show({message : "您没有选择该术语所属的刻面!"});
- }else{
- event.cancel = false;
- }
- }
- };
- //选择成功后往返集合里加数据
- Model.prototype.treeGridRowChecked = function(event){
- var row = event.row.row;
- var data = this.comp("selectData");
- if(event.checked){
- var options = {
- defaultValues : [
- {
- fID:event.rowID,
- fName:row.fName.value.latestValue,
- fNodeType:row.fNodeType.value.latestValue,
- fParent:row.fParent.value.latestValue
- }
- ]
- };
- data.newData(options);
- }else{
- data.deleteData(data.getRowByID(event.rowID));
- }
- };
复制代码
|
|