This commit is contained in:
sentsin 2017-08-31 13:25:49 +08:00
parent f4a79c8431
commit 02a70bd789
5 changed files with 18 additions and 11 deletions

View File

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

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

View File

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

View File

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