mirror of https://github.com/layui/layui
update
parent
2ad64376fe
commit
f3ca826605
|
@ -64,7 +64,7 @@
|
||||||
,"joinTime": "2016-10-14"
|
,"joinTime": "2016-10-14"
|
||||||
}, {
|
}, {
|
||||||
"id": "10006"
|
"id": "10006"
|
||||||
,"username": "贤心"
|
,"username": "张三"
|
||||||
,"email": "test6@email.com"
|
,"email": "test6@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
,"joinTime": "2016-10-14"
|
,"joinTime": "2016-10-14"
|
||||||
}, {
|
}, {
|
||||||
"id": "10007"
|
"id": "10007"
|
||||||
,"username": "贤心"
|
,"username": "张三7"
|
||||||
,"email": "test7@email.com"
|
,"email": "test7@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
,"joinTime": "2016-10-14"
|
,"joinTime": "2016-10-14"
|
||||||
}, {
|
}, {
|
||||||
"id": "10008"
|
"id": "10008"
|
||||||
,"username": "贤心"
|
,"username": "张三8"
|
||||||
,"email": "test8@email.com"
|
,"email": "test8@email.com"
|
||||||
,"sex": "男"
|
,"sex": "男"
|
||||||
,"city": "浙江杭州"
|
,"city": "浙江杭州"
|
||||||
|
@ -95,5 +95,38 @@
|
||||||
,"ip": "192.168.0.8"
|
,"ip": "192.168.0.8"
|
||||||
,"checkin": "106"
|
,"checkin": "106"
|
||||||
,"joinTime": "2016-10-14"
|
,"joinTime": "2016-10-14"
|
||||||
|
}, {
|
||||||
|
"id": "10009"
|
||||||
|
,"username": "张三9"
|
||||||
|
,"email": "test9@email.com"
|
||||||
|
,"sex": "男"
|
||||||
|
,"city": "浙江杭州"
|
||||||
|
,"sign": "人生恰似一场修行"
|
||||||
|
,"experience": 5
|
||||||
|
,"ip": "192.168.0.8"
|
||||||
|
,"checkin": "106"
|
||||||
|
,"joinTime": "2016-10-14"
|
||||||
|
}, {
|
||||||
|
"id": "10010"
|
||||||
|
,"username": "张三10"
|
||||||
|
,"email": "test10@email.com"
|
||||||
|
,"sex": "男"
|
||||||
|
,"city": "浙江杭州"
|
||||||
|
,"sign": "人生恰似一场修行"
|
||||||
|
,"experience": 5
|
||||||
|
,"ip": "192.168.0.8"
|
||||||
|
,"checkin": "106"
|
||||||
|
,"joinTime": "2016-10-14"
|
||||||
|
}, {
|
||||||
|
"id": "10011"
|
||||||
|
,"username": "张三11"
|
||||||
|
,"email": "test11@email.com"
|
||||||
|
,"sex": "男"
|
||||||
|
,"city": "浙江杭州"
|
||||||
|
,"sign": "人生恰似一场修行"
|
||||||
|
,"experience": 5
|
||||||
|
,"ip": "192.168.0.8"
|
||||||
|
,"checkin": "106"
|
||||||
|
,"joinTime": "2016-10-14"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
|
@ -63,10 +63,6 @@
|
||||||
<input type="checkbox" name="" title="锁定" checked>
|
<input type="checkbox" name="" title="锁定" checked>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="LAY_table_tpl_email">
|
|
||||||
<span {{# if(!d.activate){ }}style="color:#999"{{# } }}>{{ d.email }}</span>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="pagebarDemo">
|
<script type="text/html" id="pagebarDemo">
|
||||||
<div class="layui-btn-container">
|
<div class="layui-btn-container">
|
||||||
<button class="layui-btn layui-btn-sm" lay-event="footerDemoBtn1">底部按钮1</button>
|
<button class="layui-btn layui-btn-sm" lay-event="footerDemoBtn1">底部按钮1</button>
|
||||||
|
@ -151,13 +147,14 @@ layui.use(['table', 'dropdown'], function(){
|
||||||
,icon: 'layui-icon-tips'
|
,icon: 'layui-icon-tips'
|
||||||
}]
|
}]
|
||||||
//,escape: false
|
//,escape: false
|
||||||
|
,editTrigger: 'dblclick'
|
||||||
,cols: !1 ? test_cols : [[
|
,cols: !1 ? test_cols : [[
|
||||||
{type: 'checkbox', fixed: 'left'}
|
{type: 'checkbox', fixed: 'left'}
|
||||||
//,{type: 'numbers', fixed: 'left'}
|
//,{type: 'numbers', fixed: 'left'}
|
||||||
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
|
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
|
||||||
,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'}
|
,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'}
|
||||||
,{field:'email', title:'邮箱 <i class="layui-icon layui-icon-email"></i>', hide: 0, width:150, edit: 'text', templet: function(d){
|
,{field:'email', title:'邮箱 <i class="layui-icon layui-icon-email"></i>', hide: 0, width:150, edit: 'text', templet: function(d){
|
||||||
return '<em>'+ layui.util.escape(d.email) +'</em>'
|
return '<em>'+ layui.util.escape(d.email) +'</em> <input type="checkbox" title="激活">'
|
||||||
}}
|
}}
|
||||||
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
|
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
|
||||||
,{field:'city', title:'城市', width:120, templet: '#cityTpl', exportTemplet: function(d, obj){
|
,{field:'city', title:'城市', width:120, templet: '#cityTpl', exportTemplet: function(d, obj){
|
||||||
|
|
|
@ -470,7 +470,7 @@
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
//本地持久性存储
|
// 本地持久存储
|
||||||
Layui.prototype.data = function(table, settings, storage){
|
Layui.prototype.data = function(table, settings, storage){
|
||||||
table = table || 'layui';
|
table = table || 'layui';
|
||||||
storage = storage || localStorage;
|
storage = storage || localStorage;
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
return settings.key ? data[settings.key] : data;
|
return settings.key ? data[settings.key] : data;
|
||||||
};
|
};
|
||||||
|
|
||||||
//本地会话性存储
|
// 本地临时存储
|
||||||
Layui.prototype.sessionData = function(table, settings){
|
Layui.prototype.sessionData = function(table, settings){
|
||||||
return this.data(table, settings, sessionStorage);
|
return this.data(table, settings, sessionStorage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1707,17 +1707,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||||
tr.remove();
|
tr.remove();
|
||||||
that.scrollPatch();
|
that.scrollPatch();
|
||||||
}
|
}
|
||||||
,update: function(fields){ //修改行数据
|
,update: function(fields, ){ //修改行数据
|
||||||
fields = fields || {};
|
fields = fields || {};
|
||||||
layui.each(fields, function(key, value){
|
layui.each(fields, function(key, value){
|
||||||
var td = tr.children('td[data-field="'+ key +'"]')
|
var td = tr.children('td[data-field="'+ key +'"]');
|
||||||
,cell = td.children(ELEM_CELL); //获取当前修改的列
|
var cell = td.children(ELEM_CELL); //获取当前修改的列
|
||||||
|
|
||||||
// 更新缓存中的数据
|
// 更新缓存中的数据
|
||||||
if(key in data) data[key] = value;
|
if(key in data) data[key] = value;
|
||||||
|
|
||||||
|
// 更新相应列视
|
||||||
|
// 若要更新其它列与之有关的动态模板,直接采用 reloadData 方法
|
||||||
that.eachCols(function(i, item3){
|
that.eachCols(function(i, item3){
|
||||||
//更新相应列视图
|
|
||||||
if(item3.field == key){
|
if(item3.field == key){
|
||||||
cell.html(parseTempData.call(that, {
|
cell.html(parseTempData.call(that, {
|
||||||
item3: item3
|
item3: item3
|
||||||
|
@ -1725,21 +1726,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||||
,tplData: data
|
,tplData: data
|
||||||
}));
|
}));
|
||||||
td.data('content', value);
|
td.data('content', value);
|
||||||
item3.templet && that.renderForm();
|
|
||||||
} else if(item3.templet || item3.toolbar){ //更新所有其他列的模板
|
|
||||||
var thisTd = tr.children('td[data-field="'+ (item3.field || i) +'"]')
|
|
||||||
,content = data[item3.field];
|
|
||||||
thisTd.children(ELEM_CELL).html(parseTempData.call(that, {
|
|
||||||
item3: item3
|
|
||||||
,content: content
|
|
||||||
,tplData: data
|
|
||||||
}));
|
|
||||||
thisTd.data('content', content);
|
|
||||||
that.renderForm();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
that.renderForm();
|
that.renderForm();
|
||||||
}
|
}
|
||||||
}, sets);
|
}, sets);
|
||||||
|
|
Loading…
Reference in New Issue