Plugin - EasyUI

COMBOBOX

1. 多选下拉框取值

$('#id').combobox('getText');

$('#id').combobox('getValues');

 

DATABOX

1. datebox取值

$('#id').datebox('getValue');

 

TABS

1. tabs获取选定的tab

var tab = $("#tabs").tabs('getSelected');

var title = tab.panel('options).title;

2. tabs关闭选定的tab

var tab = $("#tabs").tabs('getSelected');

var index = $("#tabs").tabs('getTabIndex',tab);

$("#tabs").tabs('close',index);

 

DATAGRID

1. DataGrid 日期格式化

<table>
  <thead>
    <th formatter="dateconvert" data-options="field:'time'">时间</th>
  </thead>
</table>
// 参数 
// value : 字段值
// rowData : 行数据
// rowIndex : 行索引
function dateconvert(value)
{
    return value == null ? null : value.substr(0, 10);
}

2. DataGrid DetailView

引用 datagrid-detailview.js   下载地址在官网

<table id = "table">
  <thead>
    <th data-options="field:'ID'">时间</th>
  </thead>
</table>
data_grid = $('#data_table').datagrid({
        view: detailview,  // 标注为detailview视图
        url: '/GetData',
        detailFormatter: function (index, row) { // 子表格格式  
            return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';
        },
        onExpandRow: function (index, row) { // 子表格展现和数据 
            $('#ddv-' + index).datagrid({
                url: '/GetData2?ID=' + (row.ID),
                height: 'auto',
                columns: [[
                    { field: 'Name', title: '名字' },
                ]],
                onResize: function () {
                    data_grid.datagrid('fixDetailRowHeight', index);
                },
                onLoadSuccess: function () {
                    setTimeout(function () {
                        data_grid.datagrid('fixDetailRowHeight', index);
                    }, 0);
                }
            });
        }
    });

 

posted @ 2016-01-27 16:52  `Laimic  阅读(167)  评论(0)    收藏  举报