Webix 常用控件使用实例

原文及更多教程请查看:
http://fire.lvzmen.cn/index.php?app=article&ac=show&id=3
1、文本框

示例默认条件:不能为空,不大于64个字符,出错提示(红色字体,红色文本边框)

{
id: “add_frame_name”,
name: “frame_name”,
view: “text”,
label: “框架名称:”,
labelWidth: 150,
width: 450,
inputWidth: 450,
required: true,
attributes: {maxlength: 64}
validate:webix.rules.isNotEmpty,
invalidMessage: “框架名称不能为空”
}
2、多选框

多选,可以在弹出的列表框中多选选项。

{
id: “add_frame_company”,
name: “company_name”,
view: “multicombo”,
label: “关联分公司:”,
labelWidth: 150,
width: 450,
inputWidth: 450,
options: {
body: {
yCount: 5
}
}
//在页面初始化的时候加载下面代码
ajaxpost(‘/list/index/company?limit=true’, function (response) {
response = JSON.parse(response);
insertDataToList(‘add_frame_company’, response.data);
});
}
3、列表框

{

   id: "add_frame_supplier",
   name: "supplier_name",
   view: "combo",
   label: "供应商:",
   labelWidth: 150,
   width: 450,
   inputWidth: 450,
   options: {
       body: {
           yCount: 5
       }
   }
        ajaxpost('/list/index/supplier?limit=true', function (response) {
            response = JSON.parse(response);
            insertDataToList('add_frame_supplier', response.data);
        });

}
4、起止时间

{
cols: [
{
label: “起止时间:”,
labelWidth: 150,
view: “datepicker”,
id: “start_time”,
width: 300,
required: true,
format: “%Y-%m-%d”
},
{
label: “-“,
labelWidth: 20,
view: “datepicker”,
id: “end_time”,
width: 150,
format: “%Y-%m-%d”
}
]
},

//起始时间不能为空
if(

("start_time").getValue() == null){
(“start_time”).focus();
alert(“起始时间不能为空”);
return false;
}
5、数字输入框

必须为数字,可以为负数,也可以有小数点,在点击提交时通过form.validate()函数进行校验。

{
id: “add_frame_limit_days”,
name: “limit_days”,
view: “text”,
label: “账期:”,
labelWidth: 150,
width: 450,
inputWidth: 450,
required: true,
validate:webix.rules.isNumber,
on:{
“onChange”:function(){
this.validate();
}},
invalidMessage: “账期必须为数字!”
},

6、列表

{
view: “treetable”, id: ‘datatable’,
select: true,
columns: [
{id: “order”, header: “序号”, width: 50, fillspace: true},
{id: “frame_name”, header: “框架名称”, width: 150, fillspace: true},
{id: “supplier_name”, header: “供应商”, width: 300, fillspace: true},
{id: “start_time_char”, header: “起始日期”, width: 150, fillspace: true},
{id: “end_time_char”, header: “结束日期”, width: 150, fillspace: true},
{id: “contract_number”, header: “合同编号”, width: 150, fillspace: true},
{id: “status”, header: “状态”, width: 150, fillspace: true},
{id: “operate”, header: “操作”, width: 150, fillspace: true},
{id: “frame_id”, hidden: true}
]
},

//列表不能为空
var site_list_length = $$(“datatable”).count();
if(site_list_length == 0){
alert(“必须至少选择一个站点!”);
}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值