Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
Checkbox in Grid Header and Select All functionality
posted

Hi I need a ultrawebgrid with column(0) as checkbox. When I check the header checkbox i have to check all the checkboxes in the column(0).

how to do this. early response would be greatly appreciated.

Thanks,

ATMY@chevron.com 

 

Parents
No Data
Reply
  • 294
    posted

     Javascript is:


    //variable used to retain a reference to the grid for when we need to check all the roads.
    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.getRow(i).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");
    }

     

    Band using this is (note usage of name of the checkbox in script above and templated column below):

     

    <igtbl:UltraGridBand BaseTableName="myTable" Key="key" >
                            <columns>
    <igtbl:UltraGridColumn Hidden="True" Key="key" BaseColumnName="key"></igtbl:UltraGridColumn>
    <igtbl:TemplatedColumn Key="someKey" Type="CheckBox" BaseColumnName="ColumnWhatever" AllowUpdate="Yes">

    <HeaderTemplate>
                                        <input id="cbSelectAll" name="cbSelectAll" type="checkbox" onclick="BLOCKED SCRIPTSelectAll(1)"   />
                                   
    </HeaderTemplate>
    </igtbl:TemplatedColumn>

Children