【问题标题】:Change column type of a grid dynamically动态更改网格的列类型
【发布时间】:2018-02-24 01:01:58
【问题描述】:

您好,我正在使用 dhtmlx,我有一个 gridview,我希望列类型有时会在不同的行中改变

这是我加载网格的代码

                    mygrid = new dhtmlXGridObject('gridbox');
                    mygrid.imgURL = "/dhtmlxGrid/sources/imgs/";
                    mygrid.setHeader("Tipo,Actividad,Cantidad", null, ["text-align:center;","text-align:center;","text-align:center;","text-align:center;"]);
                    mygrid.attachHeader("#numeric_filter,#text_filter,#text_filter,#numeric_filter");
                    mygrid.setSkin("dhx_web");
                    mygrid.setInitWidths("100,200,300,75")
                    mygrid.setColTypes("coro,txttxt,dyn");
                    mygrid.setColAlign("left,left,right");
                    mygrid.setColSorting("str,str,int");
                    mygrid.enableBlockSelection();
                    mygrid.enableMultiline(true);
                    mygrid.init();

这是我要更改列类型的地方

function agre_regi()

{

if(document.getElementById("cmbCata_repo").value == 5 || document.getElementById("cmbCata_repo").value == 6)
{
        mygrid.addRow(mygrid.getRowsNum()+1,[document.getElementById('cmbCata_repo').value,document.getElementById('txtCausas').value,document.getElementById('txtCantidad').value]);           
}else
{
        mygrid.addRow(mygrid.getRowsNum()+1,[document.getElementById('cmbCata_repo').value,cmbActividad.getSelectedText(),document.getElementById('txtCantidad').value]);
}

}

如果你进入第一个如果我想做 mygrid.setColTypes("coro,txttxt,dyn") 别的 mygrid.setColTypes("coro,coro,dyn")

【问题讨论】:

    标签: grid dhtmlx column-types


    【解决方案1】:

    您可以使用 setCellExcelltype() 方法动态更改网格中任何单元格的类型: https://docs.dhtmlx.com/api__dhtmlxgrid_setcellexcelltype.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-06
      • 2015-04-04
      • 2013-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多