public.component.assets.custom.control.js Maven / Gradle / Ivy
/*
* Copyright Loy Fu. 付厚俊
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function checkbox(cellValue){
return cellValue?'':'';
}
function combineFieldName(fieldName){
var strs=fieldName.split("\.");
var temp = "";
for (i=0;i1){
colModel.formatter=function(cellvalue, options, rowObject){
var strs=options.colModel.name.split("\.");
var v = rowObject;
for(var j=0;j ');
}
}
$('#'+id,$container).trigger("chosen:updated");
}
}
}
};
this.edit = function (id){
var self = this;
self.clearForm();
$('#'+submitBtnId,$container).attr("url",loyModel.modelName+"/update");
$('#'+editModalDivId,$container).modal("show");
$.loy.ajax({
url:loyModel.modelName+'/get',
data:{id:id},
success:function(data){
var result = data.data;
$('#id',$container).val(result.id?result.id:'');
self.fillForm(result);
}
});
};
this.detail =function (result){
for(var i=0;i ':'';
$('#view_'+id,$container).html(v);
}else{
$('#view_'+id,$container).html(v?v:'');
}
}
}
};
this.view = function (id){
$('#'+viewModalDivId,$container).modal("show");
var detail = this.detail;
$.loy.ajax({
url:loyModel.modelName+'/detail',
data:{id:id},
success:function(data){
var result = data.data;
detail(result);
}
});
};
this.add = function add(){
this.clearForm();
$('#id',$('#'+editModalDivId,$container)).val("");
$('#'+submitBtnId,$container).attr("url",loyModel.modelName+"/save");
$('#'+editModalDivId,$container).modal("show");
};
this.submit = function(){
var self = this;
var url = $(this).attr("url");
$.loy.ajax({
url:url,
data:$("#"+editFormId,$container).serialize(),
success:function(data){
if(data.success){
$('#'+editModalDivId,$container).modal("hide");
self.grid.trigger("reloadGrid");
}
}
});
};
function buildQueryInputHtml(inputType,id,name,i18n,properties){
var i18nValue = $.i18n.prop(i18n);
var inputTypes = {
text:function(id,name,i18n,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push("");
return buffer.join('');
},
select:function(id,name,i18n,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
return buffer.join('');
},
date:function(id,name,i18n,properties){
var buffer = [];
var i18nStartKey = i18n+"Start";
var i18nEndKey = i18n+"End";
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
return buffer.join('');
},
};
return inputTypes[inputType](id,name,i18n,properties);
};
function buildInputHtml(inputType,id,name,i18n,properties){
var i18nValue = $.i18n.prop(i18n);
var inputTypes = {
checkbox:function(id,name,i18n,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
return buffer.join('')
},
text:function(id,name,i18n,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
return buffer.join('')
},
text_area:function(id,name,i18nValue,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push(' ');
buffer.push('');
buffer.push('');
return buffer.join('');
},
date:function(id,name,i18nValue,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push('');
return buffer.join('');
},
select:function(id,name,i18nValue,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push(' ');
buffer.push('');
buffer.push('');
return buffer.join('');
},
search_text:function(id,name,i18nValue,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push(' ');
buffer.push('');
buffer.push('');
return buffer.join('');
},
integer:function(id,name,i18nValue,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push(' ');
buffer.push('');
buffer.push('');
return buffer.join('');
},
float:function(id,name,i18nValue,properties){
var buffer = [];
buffer.push('');
buffer.push('');
buffer.push('');
buffer.push(' ');
buffer.push('');
buffer.push('');
return buffer.join('');
}
};
return inputTypes[inputType](id,name,i18nValue,properties);
};
this.buildDetailWin =function (){
var temp = [];
temp.push('');
temp.push('');
temp.push('');
temp.push(' ');
temp.push(' ');
temp.push('');
temp.push('
');
temp.push('
');
var str = temp.join(" ");
$container.append(str);
return str;
};
this.buildQueryForm = function(){
var self = this;
var temp = [];
var often = false;
var oftenQueryCol = null;
temp.push('');
temp.push('
');
temp.push(' ');
temp.push('');
temp.push('
');
temp.push('');
temp.push('
');
temp.push(' ');
temp.push(' ');
var display = often?"none":"";
temp.push(' ');
temp.push('