Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Adaptive filter behaviour override in javascript & JSP

    Hi everyone,

    I'm working with the smartclient and a ListGrid in javascript/jsp to display some information from the database.
    Recently I have had to change the data type of one of the returned columns. It was changed from a NUMBER to VARCHAR2.

    As a result I am no longer able to use the adaptive filter functions as if it were a number. Functions such as '>100','!0' etc...

    Is there a way I can override the filter behaviour of an adaptive filter for a specific column, so that I can insert my own String number comparator?
    Or better yet, are there any properties that can be configured to allow a string column to be handled as a number?

    I cannot post the entire JSP file, but if you need some specific information please let me know.

    Any help with this would be greatly appreciated.


    #2
    Hi Wanotiki,

    if you can gurantee that the VARCHAR2 is actually a number, you could leave everything as it is and just use a customSelectExpression in your .ds.xml, something like customSelectExpression="TO_NUMBER(myCol)".
    This is the easiest way to solve it. Your column is read-only in your application, correct? If not, perhaps you'll also need customUpdateExpression.

    Otherwise you can try ListGridField.filterEditorProperties and pass a FormItem with a special criterionGetter.
    For number-sorting you'll need a ListGridField.sortNormalizer.

    Best regards
    Blama

    Comment


      #3
      Hi Blama ,

      Thanks for your quick reply!

      I realise now that I left out some useful information from my original post. :(

      The reason the data was changed to varchar2 was so that javascript would not round the values which resulted in a loss of decimal precision.
      When the report first loads data from the source the value would display correctly, however once a refresh of the listgrid happens, the value becomes a rounded integer.

      If you have any thoughts on this I'd be happy to hear them.

      In the meantime I'll take a look at some of the other options you've suggested!

      Regards,
      Wano

      Comment


        #4
        Hi Wanotiki,

        there is also stringInBrowser (v5.1p+). Is/Was the field type in SmartGWT integer or float?
        If this is happening for float with a small, reasonable precision, this might be a bug(?).

        In the same docs, there are also decimalPrecision and decimalPad, which might be of interest.

        Best regards
        Blama

        Comment

        Working...
        X