Custom Filter does not work due to sorting

Posted by: clifford-fp on 8 September 2017, 12:28 pm EST

  • Posted 8 September 2017, 12:28 pm EST

    Hi All,


     


    I am using the Farpoint control V2.0.3.0 and facing the problem. After sorting the column the custom filter is not working. Let me explain the problem in details.


     


    Farpoint has provided the sample project “SpreadWinDemo” which shows the various feature of Farpoint. I want to use the Advanced Filter functionality in my application but before that I made minor modification in sample project to test the feature.


     


    I have modified the code so that it allows user to sort the records. After this i execute the project. I apply the custom filter on Company name column and then filter the records with the records starts with “D”.


     


    The Grid filter the records and shows following.


     
















    ID


    Company Name


    17


     Drachenblut Delikatessen


    18


     Du monde entier


    86


     Die Wandernde Kuh


     


    Now sort the company name column and again filter the records with the records starts with “D”. This time grid filter records and shows following.


     
















    ID


    Company Name


    17


     Drachenblut Delikatessen


    18


     Du monde entire


    19


     Eastern Connection


     


    Please note third record where Company name does not starts with D.


     


    I also found that row index of records are different before and after sorting. It seems that farpoint use original row index to filter the records. Can anyone please advice what is worng in sample project to resolve this problem?


     



    Thanks in Advance!


     


    Clifford

  • Replied 8 September 2017, 12:28 pm EST

    Clifford,


    This is correct. The Spread uses two coordinate systems. A model coordinate system that is how the data is stored in the models and a view coordinate system that is how the data is displayed to the user. This makes manipulation of the Spread much faster, but can become confusing when these coordinates are different, like after a sort.


    I am assuming you are using a custom filter to look through the data to determine what rows to filter. You need to use the GetViewRowFromModelRow or GetModelRowFromViewRow method to get the correct coordinates. Depending on how you have set the custom filter to get the data to check if it needs filtering would answer which method to use.

  • Replied 8 September 2017, 12:28 pm EST

    Thanks scotts for the prompt reply. We have used GetModelRowFromViewRow here and now custom filter is working.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels