jQWidgets Forums

jQuery UI Widgets Forums Grid small column width

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  arkgroup 7 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • small column width #97081

    arkgroup
    Participant

    I need to show grid with column width = 10px. I think default is 25px. So I use cellclassname and set width in class: width: 10px!important;
    The grid looks wrong. Cell still occupied 25px with left border. Here is the code from demo. Also, how do I change header width?

     <style>
         
             .a1 {
                 width: 10px!important;
                 
             }
        </style>
        <script type="text/javascript">
            $(document).ready(function () {
                var url = "../sampledata/beverages.txt";
                var cellclass = function (row, columnfield, value) {
                   
                    return 'a1';
                }
                // prepare the data
                var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'name', type: 'string' },
                        { name: 'type', type: 'string' },
                        { name: 'calories', type: 'int' },
                        { name: 'totalfat', type: 'string' },
                        { name: 'protein', type: 'string' },
                    ],
                    id: 'id',
                    url: url
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                $("#jqxgrid").jqxGrid(
                {
                    source: dataAdapter,
                    width: 850,
                    columns: [
                      { text: '', datafield: 'name', cellclassname: cellclass },
                      { text: '', datafield: 'type', cellclassname: cellclass },
                      { text: '', datafield: 'calories', cellclassname: cellclass},
                      { text: '', datafield: 'totalfat', cellclassname: cellclass },
                      { text: '', datafield: 'protein',  cellclassname: cellclass }
                  ]
                });
            });
        </script>
    
    small column width #97084

    Peter Stoev
    Keymaster

    Hi arkgroup,

    Set the minwidth of the column to 10, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com

    small column width #97085

    arkgroup
    Participant

    Thanks!

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

You must be logged in to reply to this topic.