mirror of https://github.com/layui/layui
微调 table 示例细节
parent
692e245d62
commit
3c6c24e958
|
@ -168,7 +168,7 @@
|
|||
|
||||
<h3 id="demo-setRowChecked" lay-toc="{level: 2, hot: true}" class="ws-bold">选中行操作</h3>
|
||||
|
||||
点击行任意处,通过行事件中执行相关选中方法,实现对整行的状态选中。
|
||||
点击行任意处,通过行事件中执行相关选中方法,实现对整行的状态选中。*如下以「单选」行为例:*
|
||||
|
||||
<pre class="layui-code" lay-options="{preview: true, codeStyle: 'height: 508px;', layout: ['preview', 'code'], tools: ['full'], toolsEvent: function(oi, type){
|
||||
if(type === 'full'){
|
||||
|
|
|
@ -40,7 +40,7 @@ layui.use(function(){
|
|||
elem: '#ID-table-demo-search',
|
||||
url: '/static/2.8/json/table/user.json', // 此处为静态模拟数据,实际使用时需换成真实接口
|
||||
cols: [[
|
||||
{checkbox: true, fixed: true},
|
||||
{type: 'radio', title: '😊', fixed: true}, // 单选框
|
||||
{field:'id', title: 'ID', width:80, sort: true, fixed: true},
|
||||
{field:'username', title: '用户名', width:80},
|
||||
{field:'sex', title: '性别', width:80, sort: true},
|
||||
|
|
|
@ -16,7 +16,7 @@ layui.use('table', function(){
|
|||
url: '/static/2.8/json/table/user.json', // 此处为静态模拟数据,实际使用时需换成真实接口
|
||||
page: true,
|
||||
cols: [[
|
||||
{type: 'radio', fixed: 'left'},
|
||||
// {type: 'radio', fixed: 'left'},
|
||||
{field:'id', title:'ID', width:80, fixed: 'left', unresize: true},
|
||||
{field:'username', title:'用户', width:120},
|
||||
{field:'sex', title:'性别', width:80},
|
||||
|
@ -43,7 +43,7 @@ layui.use('table', function(){
|
|||
|
||||
// 标注当前点击行的选中状态
|
||||
obj.setRowChecked({
|
||||
type: 'radio' // 单选模式
|
||||
type: 'radio' // radio 单选模式;checkbox 复选模式
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue