jQWidgets Forums

jQuery UI Widgets Forums Grid How does the filter decide to show string options?

This topic contains 3 replies, has 1 voice, and was last updated by  ajcs 5 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • ajcs
    Participant

    I have the following columns:

    { text: ‘Test’, dataField: ‘Test’, width: 150 },
    { text: ‘Description’, dataField: ‘Description’, width: 150 },

    When the filter menu shows for the Test column its first filter option is “contains” – this is what I expect because it is string data.

    When the filter menu shows for the Description column its first filter option is “less than” – This seems like the filter option for numeric data – but this is still a string so why is it showing numeric filter options?

    The difference between Test and Description is that Test is a simple data property but Description is reading from an object getter (the object is written in Typescript).

    So what decides if you show the string data filter options or the numeric filter options?
    And can I control it?


    ajcs
    Participant

    Following on from this it seems you have a problem if the dataField refers to a property with a getter rather than a simple field because the filters do not then work.

    e.g. On my data entity per row:

    // Simple field – this will work fine for filtering on either as a string filter or checkedlist filter
    Test = “Testing”;

    // Getter – this will not work properly – it displays the data in the grid ok – but the normal filter treats it as numeric (as mentioned above) and the checkedlist will just not work and throws an exception

    get Description(): string {
    return this.GetValue(“Description”);
    }


    ajcs
    Participant

    More info – the above getter is in typescript so the compiled JS looks like the following:
    Object.defineProperty(AttributeMaster.prototype, “Description”, {
    get: function () {
    return this.GetValue(“Description”);
    },
    set: function (Value) {
    this.SetValue(“Description”, Value);
    },
    enumerable: true,
    configurable: true
    });

    So my question is can the grid work with properties as data fields or can it only work with simple fields?


    ajcs
    Participant

    Sorry I have found the problem. It seems property getters are working. I was not defining the data types correctly on the data source.

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

You must be logged in to reply to this topic.