cjm19682

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • in reply to: custom local sort with respect of the function as index #95344
    cjm19682
    Participant

    I really need to make this idea of a custom sorttype work, and tried using Tony's idea, but can't make it work. Please, can anyone help!

    I am using jqGrid 3.7.2 with local data. The code below is my best attempt at getting it to work – I can't make it call the custom sorting function though. The idea is to sort the 'Posn' field in the order 'GK'->'DEF'->'MID'->'STR'.

    in reply to: Local Data: Rows disappear when users sort #95343
    cjm19682
    Participant

    I got this to work by adding a

    rowNum: 100

    into the colModel. This wasn't required in 3.6.4, but seems to be needed in 3.7.2 even though I'm not using a pager.

    in reply to: setColumns modal dialog #93736
    cjm19682
    Participant

    Hi Tony,

    in reply to: Date Sorting in local table. #93701
    cjm19682
    Participant

    Brilliant, thanks for your help. Works OK as follows:

    $(“#MarkupTable”).jqGrid('setColProp','Date',{sorttype:'date', formatter:'date', datefmt: 'd-m-y'});

    A few observations that might help others:

    • I do notice that the date handling is quite fussy when datatype is “clientSide”. When row content comes from HTML markup (using tableToGrid), the datefmt doesn't get used for actual formatting – that gets taken from the HTML markup, but the datefmt property is still required to make the sorting work.

    • Similarly, if data is imported in JSON using the 'addRowData' function, the formatting seems to be determined by the value of newformat in the localisation file e.g. grid-locale-en.js

    • The demos all seem to have dates formatted as Y-m-d, which will sort correctly as string-text, so I think the date-format demo code is often incorrect and the data is only correctly sorted because the text sorting produces the same results as date sorting for the given data and configuration parameters. Definitely worth changing example formatting as this is the only way to illustrate the code working correctly.
Viewing 4 replies - 1 through 4 (of 4 total)

Stay connected with us in your favorite flavor!