Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Filtering by a character string
posted

Hello.

i used fomatter.

dataSource is [{"phase": 0},{"phase": 1}.....]

--------------------

    var phaseTable = [
                         { "phase": 0, "name": "kaihatsu" },
                         { "phase": 1, "name": "unyou" },
                     ];


    this.getPhaseName = function(phase) {
        var i, category, val;
        for (i = 0; i < phaseTable.length; i++) {
            category = phaseTable[i];
            if (category.phase== phase) {
                val = category.name;
            }
        }
        return val;
    }

.....

    { headerText: "phase", key: "phase",  dataType: "number" , formatter: getPhaseName },


--------------------

It could be confirmed to be able to show "kaihatsu" and "unyou" to a iggrid.

I'd like to filter it by inputting "kaihatsu" or "unyou".

When inputting "0" or "1", it can be filtered.

please help me.

Parents
No Data
Reply
  • 15320
    Offline posted

    Hello hide gotoh,

    It's not possible to filter column with number datatype using string conditions out of the box. Instead I suggest you to define unbound column similar to the number column, populated with string data in order filtering expressions for this column to be properly updated. For instance:

    var phaseTable = [
       { "phase": 1, "name": "kaihatsu" },
       { "phase": 2, "name": "unyou" },
       { "phase": 3, "name": "kaihatsu" },
       { "phase": 4, "name": "unyou" }
         ];

    function populateUngoundColumne(data, grid){
       return data["name"];
      }

    ...

    columns: [
                        { headerText: "phase", key: "phase",  dataType: "number" , formatter: getPhaseName, hidden: true },
         { headerText: "phase", key: "fakePhase",  dataType: "string" , unbound: true, formula: populateUngoundColumne },
         { headerText: "name", key: "name",  dataType: "string" }
                    ]

    If you have further questions, please let me know.

    Regards,

    Tsanna

Children
No Data