jQWidgets Forums

jQuery UI Widgets Forums Grid Issue with Percentage width for columns

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Issue with Percentage width for columns #48976

    ssp
    Participant

    Hi,

    grid was created with multiple columns and their width are specified in percentage (%).

    Grid continuously flickers and does not allows editing of cell values,
    this issue is not observed when the width is set in px!

      $("#jqxgridDaily").jqxGrid(
                {
                	//  width: 1170,
                	width: '100%',
                    source: dataAdapter,                
                    autoheight: true,
                    sortable: false,
                    altrows: true,
                    editable: true,
                    enabletooltips: true,
                   // columnsresize: true,
                    selectionmode: 'none',
                     columns: [
          					{ text: '', datafield: 'available', columntype: 'checkbox', width:'1%' },
          					{ text: 'Project Number', datafield: 'projectNumber', width: '14%', columngroup: 'ProjectDetails'  },
          	                { text: 'Project Description ', datafield: 'projectDescription',cellsalign: 'right', cellsrenderer: cellsrenderer, width: '10%',columngroup: 'ProjectDetails' },
          	                { text: 'Budget Owner', datafield: 'budgetOwner', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '10%', columngroup: 'ProjectDetails'  },
          	                { text: 'Cost Center', datafield: 'costCenter', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '10%' ,columngroup: 'ProjectDetails'},
          					{ text: 'Division',  datafield: 'division', width: '10%',columngroup: 'ProjectDetails' },
                              { text: 'Sun<br/>FEB ', datafield: 'sunday', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '5%' },
                        		{ text: 'Mon', datafield: 'monday', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '5%' },
                              { text: 'Tue', datafield: 'tuesday', cellsalign: 'right', cellsrenderer: cellsrenderer, width:'5%'},
          	                  { text: 'Wed', datafield: 'wednesday', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '5%'},
          	                  { text: 'Thu', datafield: 'thursday', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '5%'},
          	                  { text: 'Friay', datafield: 'friday', cellsalign: 'right', cellsrenderer: cellsrenderer, width:'5%'},
          	                  { text: 'Saturday', datafield: 'saturday', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '5%'} ,
          	                  { text: 'Total', datafield: 'total', cellsalign: 'right', cellsrenderer: cellsrenderer, width: '10%'} 
                          ],
     columngroups: [
                                   { text: 'Project Details', align: 'center', name: 'ProjectDetails' }
                               ]
                }); 
    
    

    Please help.

    Thanks

    Issue with Percentage width for columns #48990

    Peter Stoev
    Keymaster

    Hi ssp,

    We cannot observe such behavior with jQWidgets ver. 3.2.

    Test Sample:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title id='Description'>This example shows how to create Grid columns with percentage widths.</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/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.selection.js"></script> 
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsresize.js"></script> 
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script> 
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> 
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var url = "../sampledata/beverages.txt";
    
                // prepare the data
                var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'name' },
                        { name: 'type' },
                        { name: 'calories', type: 'int' },
                        { name: 'totalfat' },
                        { name: 'protein' },
                    ],
                    id: 'id',
                    url: url
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                $("#jqxgrid").jqxGrid(
                {
                    source: dataAdapter,
                    editable: true,
                    width: '100%',
                    autoheight: true,
                    selectionmode: 'none',
                    columns: [
                      { text: 'Name', datafield: 'name', width: '30%' },
                      { text: 'Beverage Type', datafield: 'type', width: '25%' },
                      { text: 'Calories', datafield: 'calories', width: '15%' },
                      { text: 'Total Fat', datafield: 'totalfat', width: '15%' },
                      { text: 'Protein', datafield: 'protein',  width: '15%' }
                  ]
                });
            });
        </script>
    </head>
    <body class='default'>
         <div id="jqxgrid"></div>
       </body>
    </html>
    

    I would also suggest you to do not override the built-in rendering of all cells which you display within the Grid. By doing that, you will prevent the built-in rendering optimizations.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.