jQWidgets Forums

jQuery UI Widgets Forums Getting Started grid column sorting

This topic contains 5 replies, has 2 voices, and was last updated by  Peter Stoev 10 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • grid column sorting #65238

    sunny
    Participant

    Hello sir,

    how to do the column sorting based on file size for example file size is 1Gb(gigabytes),10mb,10kb.

    Regards
    sunny

    grid column sorting #65248

    Peter Stoev
    Keymaster

    Hi Sunny,

    file size is your column’s data?

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    grid column sorting #65249

    sunny
    Participant

    hello sir,

    { text: ‘Size’, datafield: ‘Size’, width: ‘6%’, editable: false, sortable: true, cellclassname: cellclass, filtertype: ‘input’ }

    size(column)
    1gb
    200mb
    12kb
    2gb
    100mb
    100kb

    After applying sorting assending order coulmn should come like this
    size(column)
    12kb
    100kb
    100mb
    200mb
    1gb
    2gb

    Regards
    sunny

    grid column sorting #65251

    Peter Stoev
    Keymaster

    Hi sunny,

    That’s the sorting, because your data contains String. Here’s a sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/customsorting.htm?arctic which will help you to implement custom column sorting. Another way is to display Bytes as Numbers in your Column and set the column’s type to “number” and by using cellsrenderer to display kb, mb, etc. depending on the Bytes value with the proper calculation.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    grid column sorting #65344

    sunny
    Participant

    Hello team,

    I tried with cellsrenderer as you suggested and it is working now but we have a filter row for the grid so if you type KB or MB in filter input, it is not filtering the results as the data field is number and doesn’t contain any string. As well as when I hover on the cell, tool tip displays for example 1024 instead of 1 KB. Any suggestions?

    Regards,
    Sunny

    grid column sorting #65362

    Peter Stoev
    Keymaster

    Hi Sunny,

    Filtering works by filtering cell values so may be you will have to point it out to your users. You may also try the other suggestion.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.