大家好,鄙人现在遇到一个问题。
我有一个UltraWebGrid 但是他是一个父子结构的。现在我想在子列表中加一列Checkbox,然后在Header中对这实现全不选中或者全部取消。实在搞不出来 ,请大家帮忙。
我在网上依葫芦画瓢,但是Header里Checkbox 根本看不到。不知道为何。
代码如下:
<igtbl:TemplatedColumn AllowUpdate="Yes" BaseColumnName="MyCheckConfirm" Key="MyCheckConfirm"
                                                             Type="CheckBox" Width="50px">
                  <HeaderTemplate>
                        <input id="cbSelectAll"  name="cbSelectAll" type="checkbox" onclick="SelectAll(0)"/>
                  </HeaderTemplate>
                  <Header Caption="选中">
                  </Header>
</igtbl:TemplatedColumn>//JS 方法
        var oGrid;
        var cbSelectAll;        //Selects all checkboxes in the grid
        function SelectAll(colIndex)
        {
            var checked = cbSelectAll.checked;
            for (i = 0; i < oGrid.Rows.length; i++)
            {                
                oGrid.Rows.getCell(colIndex).setValue(checked);
            }
        }        //Intialization function which sets the grid reference
        function igrdInitializeLayout(object)
        {
            oGrid = igtbl_getGridById(object);          
            //need to set it here due to Infragistic’s handling of columns.
            cbSelectAll = document.getElementById("cbSelectAll");        
        }//另外Grid客户端的方法我做了绑定:InitializeLayoutHandler="igrdInitializeLayout"

请问大家,问题出在哪?怎么解决?

解决方案 »

  1.   

    应该没有这个ShowHeader 这个属性。很奇怪,如果我把这个模板列Checkbox放在父列表中,在Header中是显示Checkbox的 。但是能实现全选或者全部取消这样的功能 。
      

  2.   

    问题解决了,用了另外一种方式:谢谢热心网友  
     var oChildRows =  row.Rows;       
                    for(j=0; j<oChildRows.length; j++) {
                       //oChildRow = oChildRows.getRow(j);
                       oChildRows.getRow(j).getCellFromKey("MyCheckConfirm").setValue(false);
                    }