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
690
Filter Row not working correctly if column has input mask
posted

Hi,

I have a column with data type double. I have set inputMask ultraGrid1.DisplayLayout.Bands[0].Columns["Column1"].MaskInput = "####" so as not to see decimal places.

Also I set the value of the column = 33.33

Because I have inputMask what is see is 33.

In filter row if I open the dropdown list I can see the option 33 and if I type in the filter row 33 it shows me the row as expected.

The problem appears if I do not open the dropdown list. If I go to filter row and type 33, without having opened the dropdown, it shows me no results.

Could you please advice?

Thank you in advance

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    This is kind've an unusal thing to do - limiting the display to integers via a mask. I don't think that's really the intended use of masking.

    I tried this out and I get the same results. I think what's happening here is that the dropdown list doesn't get populated until you drop it down the first time. Once it's populated, it contains a list of DisplayText (e.g. "33") and DataValue (e.g. 33.33) pairs. So once you drop it down and type "33" it recognizes the "33" on the list and matches it up to the 33.33 value and filters based on that value.

    But before the list is populated, there's nothing to match up to and since "33" does not equal 33.33, it doesn't find anything and so there's no match.

    So one potential solution would be to force the list to populate. But unfortunately, there's currently no way to do that.

    So there are a number of approaches you could take.

    The simplest thing to do, in my opinion would be to set the FilterOperatorDefaultValue on the column to Contains. That way, the filtering will match any cell whose value contains "33" anywhere within it's text. This assumes you are using the filter row.

    Another, much more complex option, would be to handle the CellChange event of the grid, or maybe the BeforeRowFilterChanged event and watch for changes to the filter cell. Then you could try to take he filter that is applied and modify if to match the values in your actual grid column. But as I said, this would be very tricky and complex and would mean looping through all of the cells in the column manually and finding all of the potential values and matching them up yourself.

    Another approach you could type, which is sort've a hybrid of the other two is you could handle the FilterRow event. This event fires any time the grid evaluates whether or not a row meets the filter criteria. So you could examine the value of the cell and the FilterConditons (which in this case would be Equals "33") and then decide if the row meets that criteria or not.

    I attached my sample project here just for reference.

    MemDataTable CS.zip
Reply Children