Browse Source

2.1.0

pull/51/merge
sentsin 7 years ago
parent
commit
02a70bd789
  1. 2
      bower.json
  2. 2
      dist/lay/modules/table.js
  3. 2
      dist/layui.all.js
  4. 18
      src/lay/modules/table.js
  5. 5
      test/table.html

2
bower.json

@ -1,7 +1,7 @@
{
"name": "layui",
"main": "src/layui.js",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "https://github.com/sentsin/layui",
"authors": [
"sentsin <xu@sentsin.com>"

2
dist/lay/modules/table.js vendored

File diff suppressed because one or more lines are too long

2
dist/layui.all.js vendored

File diff suppressed because one or more lines are too long

18
src/lay/modules/table.js

@ -436,7 +436,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}
//数据排序
Class.prototype.sort = function(th, type, pull){
Class.prototype.sort = function(th, type, pull, formEvent){
var that = this
,field
,config = that.config
@ -494,10 +494,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}, that.page, that.count, true);
layer.close(that.tipsIndex);
layui.event.call(th, MOD_NAME, 'sort('+ filter +')', {
field: field
,type: type
});
if(formEvent){
layui.event.call(th, MOD_NAME, 'sort('+ filter +')', {
field: field
,type: type
});
}
};
//请求loading
@ -687,16 +689,16 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
} else {
type = 'asc';
}
that.sort(othis, type);
that.sort(othis, type, null, true);
}).find(ELEM_SORT+' .layui-edge ').on('click', function(e){
var othis = $(this)
,index = othis.index()
,field = othis.parents('th').eq(0).data('field')
layui.stope(e);
if(index === 0){
that.sort(field, 'asc');
that.sort(field, 'asc', null, true);
} else {
that.sort(field, 'desc');
that.sort(field, 'desc', null, true);
}
});

5
test/table.html

@ -298,6 +298,11 @@ layui.use('table', function(){
//监听排序
table.on('sort(test)', function(obj){
console.log(this, obj)
return;
table.reload('test', {
height: 300
});
});

Loading…
Cancel
Save