jQuery UI Widgets Forums Grid Grid Selectionmode:'checkbox' | disable when no records in grid

This topic contains 2 replies, has 2 voices, and was last updated by  rskbuvan 12 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • rskbuvan
    Spectator

    Hi,

    In my grid, I had set the selection mode as ‘checkbox‘ so the individual row selection/check all/un-check all can be allowed, if the grid contains atleast one row.

    In some cases, I load the grid with no data’s i.e. zero row. When I click the columnheader checkbox, I’m getting an error in IE as “Object expected” and Mozilla as “L is null”.

    Requirement:
    If there are no rows in a grid, i want to disable the column checkbox i.e. columnheader checkbox.

    Can anyone suggest me a solution?

    Looking for a prompt response.

    Thanks,
    Senthil


    Peter Stoev
    Keymaster

    Hi Senthil,

    Do you use jQWidgets 3.2.1? How can we reproduce that? I am asking because we were not able to replicate the described behavior with the current version.

    ex:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title id='Description'>This example illustrates Rows Selection with a Checkbox.
        </title>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> 
        <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script>
       <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> 
        <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {       
                var url = "../sampledata/orders.xml";
    
                // prepare the data
                var source =
                {
                    datatype: "xml",
                    datafields: [
                        { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' },
                        { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' },
                        { name: 'ShipName', map: 'm\\:properties>d\\:ShipName', type: 'string' },
                        { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress', type: 'string' },
                        { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity', type: 'string' },
                        { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry', type: 'string' }
                    ],
                    root: "entry",
                    record: "content",
                    id: 'm\\:properties>d\\:OrderID',
                    url: url
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                // create jqxgrid.
                $("#jqxgrid").jqxGrid(
                {
                    width: 850,
                    height: 450,
                //    source: dataAdapter,
                    sortable: true,
                    filterable: true,
                    ready: function()
                    {
                        // called when the Grid is loaded. Call methods or set properties here.         
                    },
                    selectionmode: 'checkbox',
                    altrows: true,
                    columns: [
                      { text: 'Ship Name', datafield: 'ShipName', width: 250 },
                      { text: 'Shipped Date', datafield: 'ShippedDate', width: 100, cellsformat: 'yyyy-MM-dd' },
                      { text: 'Freight', datafield: 'Freight', width: 80, cellsformat: 'F2', cellsalign: 'right' },
                      { text: 'Ship City', datafield: 'ShipCity', width: 100 },
                      { text: 'Ship Country', datafield: 'ShipCountry', width: 200 },
                      { text: 'Ship Address', datafield: 'ShipAddress', width: 200 }
                   ]
                });
            });
        </script>
    </head>
    <body class='default'>
        <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
            <div id="jqxgrid">
            </div>
        </div>
    </body>
    </html>

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    rskbuvan
    Spectator

    Hi Peter,

    The version I’m using is 3.1.0.

    I’ll update the library version and try the same.

    Thanks for the information.

    Cheers,
    Senthil

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.