`

wex5中list组件加入checkbox

 
阅读更多

在list组件中加入checkbox 实现多行选中时,提交能获取选中行的数据。

1.data数据中加入一个checkbox对应字段,如在userdata中加入checkbox (boolean)字段,加入字段是不会影响查出列表内容的。

2.在list组件下加入 checkbox组件,checkbox属性中将bind-ref设置为ref('checkbox'),即新加的那个字段。

3.当点击提交按钮时,如下 触发click事件,

    Model.prototype.button3Click = function(event){

//var self = this;

var userdata = this.comp('userdata');

var rows = [];

userdata.each(function(options){

if (userdata.getValue("checkbox", options.row)){/*checkbox的为true的那一行执行*/

alert(options.row.val("checkbox")+","+options.row.val("real_name"));

rows.push(options.row);

}

});

};

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics