--定义表格
m_pGrid = CLuaGridUtil();
m_pGrid:SetGrid(ui:getDialogName(),'id_grid');

--加载表格数据
local help = CSelectHelp();
local sql = [[select top 100 * from bs_eqpt with(nolock) where isnull(is_delete,0)=0]];
if db:select(sql,'',help) < 0 then
    return ui:tip(db:error());
end
m_pGrid:FromSelectHelp(help);
--或者 m_pGrid:setHelp(help);

--获取表格的选中行
local helpSel = CSelectHelp();
m_pGrid:GetSelectedValue(helpSel);
-- 或者 m_pGrid:getSelected(helpSel);
if helpSel:size() <= 0 then
    return;
end

--设置列编码
m_pGrid:setColumnCode('id_grid');

--禁用列
m_pGrid:EnableColName('eqpt_id',false);

--表格迭代
for i=0,m_pGrid:rowCount()-1 do
    print(m_pGrid:getValue(i,'eqpt_name'));
end
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""