Skip to main content

Custom Filter Values

Comments

22 comments

  • Dapfor Team

    Hi,

    In the current version the grid serializes only the type of the filter not the content. To serialize it, the ValueEqualityCheckBoxFilter class should implement IXmlSerializable interface. Your request will be forwarded to the dev team to implement it.

    Best regards,

    Dapfor

     

    0
  • Michael Sage

     Can you give me an ETA as to when I can expect to see this feature. Thanks.

    0
  • Dapfor Team

    Hello,

    We prepare a new version of the grid for the beginning of June. Our dev team will try to include required features to the upcoming release.

     

    Best regards,

    Dapfor

    0
  • Michael Sage

    Hi,

    I just downloaded your latest release - ver 2.9 and see that you have put in the filter serialization feature that I was looking for. Thanks for making that feature available.

    I did notice one problem though. If I save my grid with none of the filters set, then I cant seem to initialize my grid with the xml that I saved. The application basically hangs at that point. Here is an example of the serialized grid state, can you tell me why this is happening. 

    Thanks,

     




    dapfor.xml
    0
  • Dapfor Team

    Hi,

    Thank you for the report. This is our bug. Our dev. team has already found it and will release a new version in few days.

    Best regards,

    Dapfor

     

    0
  • Dapfor Team

    Hi,

    Let us know if there are some other dysfunctions in the grid. We can include minor bug fixes into upcoming release if any.

    Best regards,

    Dapfor

    0
  • Michael Sage

    Thanks, Can you tell me when the fix will be ready ?

    0
  • Dapfor Team

    Dear Deepak,

    The fix is ready and will be available tomorrow.

    Best regards,

    Dapfor

     

    0
  • Dapfor Team

    The version 2.9.1 is now available.

    Best regards,

    Dapfor

     

    0
  • Michael Sage

    Thanks for providing Version 2.9.1 . I has been quite helpful. I did have a question about the filters though. I have a column "Status" which can take values such as "Working", "Canceled", "Pending". when I open the grid for the first time, the filter is obviously empty, but I have some data come in and then save the state of the grid. I have the "Working" checked but have "Canceled " and "Pending" unchecked. When I restart my application and use my saved grid state, the column filter only comes up with "Working" , it does not seem to save the other two states.  Is it possible to save the other two states as well and have them come up unchecked ? 

    0
  • Dapfor Team

    Hello Deepak,

    The ValueEqualityCheckBoxFilter doesn’t need to save 2 other states. It saves only active states (if the filter was active). Unchecked states are not used to filter data. But they will be visible in the drop down box.

    Best regards,

    Dapfor

     

     

    0
  • Michael Sage

    I believe unchecked states are important and need to be saved. Let me give you an example.

    I start up my application with no filters applied to the grid.  I then populate my grid with two rows. The column "Status" shows "Working" for one row and "Canceled" for the other. I then uncheck  the "Canceled" value in the filter. So my grid only shows one row now ie "Working". I then save the grid state and exit the application.  When I restart my application, I see the filter for the "Status" column repopulated, but it only has "Working" checked, I don't see "Canceled" in the filter at all. Once I start populating the grid again with data, I see "Canceled" in the filter since I populated the grid with an object having that value. But the filter itself has "Canceled" checked and that row is visible. 

    What I would really like to see is the "Canceled" show up unchecked in the filter either before or after I populate the grid. But it doesn't seem to save the state of unchecked items and therefore the user will have to un check it each time and it defeats the purpose of saving the filter state.

     

    0
  • Dapfor Team

    Thank you.

    In this case we have a question: what’s the grid's behavior if deserialized fields don’t match to populated data?

    It seems that the list of available values should be set at the filter initialization and not be deserialized. Only internal state of the filter should be serialized

    The grid 2.9.1 supports xml serialization of any graphical filter. We can create a new graphical filter with serialization facilities and a list of predefined values passed to the constructor. This code you can integrate into your project. And if the filter satisfy your needs and is enough generic, we can integrate it into the next version of the grid.

    What do you think?

     

     

     

    0
  • Michael Sage

    Sure, I can give the new graphical filter with serialization and constructor a shot. It might need some modifications as I use it, but I think it will be a great addition to the grid. Please let me know when its available. Thanks for all your efforts, I really appreciate it.

    0
  • Dapfor Team

    We'll send you filter sources in 1-2 days.

    0
  • Dapfor Team

    Dear Deepak,

    Please find a new filter in attachments. You can set required values in the constructor:

    column1.Filter = new ValueEqualityCheckBoxFilter2(new object[] { 1, 5, 7, 8 });
    column2.Filter = new ValueEqualityCheckBoxFilter2(Enum.GetValues(typeof(SortDirection)));

     

    We'll also add this filter into the next version of the grid.

    Best regards,

    Dapfor

     

     




    ValueEqualityCheckBoxFilter2.cs.zip
    0
  • Michael Sage

    Thanks for the code, but I'm unable to compile. The error I get is 

    "

    Error 27 'Dapfor.Net.Ui.Column' does not contain a definition for 'impl' and no extension method 'impl' accepting a first argument of type 'Dapfor.Net.Ui.Column' could be found (are you missing a using directive or an assembly reference?) C:\Users\trader\Desktop\src\GUI\Trader\Utility\ValueEqualityCheckBoxFilter2.cs 586 . 

    Its on line 586 in the On_KeyDown method. Also is it possible to send me images used in the filter ? I can compile by commenting them out , but it would be nice to have them.

     

    Thanks.

    0
  • Michael Sage

    Also, is it still possible to new items to the filter as they get populated int the grid. It would be great to have the best of both world, we can initalize the filter from saved settings as well as add new items as they populate the grid. 

    0
  • Dapfor Team

    Hello,

    The Dapfor.Net.dll provides an access to its internal methods to the Dapfor.Test assembly. This is the reason why we didn't see these calls. Please, find a new version of the filter. We've also added a code which extracts existing images from the Dapfor.Net.dll.

    Best regards,

    Dapfor

     




    ValueEqualityCheckBoxFilter2.zip
    0
  • Dapfor Team

    The filter should have 2 constructors:

    1. Empty constructor - otherwise it's not possible to deserialize filter from the xml stream.

    2. Constructor with a list of available values (called at grid initialization time).

    In both cases available values are set only once - not at each filter opening. After deserialization a new filter is created (empty constructor + ReadXml method are called). Note: this new filter erases the previous one. 

    An example of the xml file with serialized values:

     

    <?xml version="1.0"?>
    <DapforNetGrid ver="1">
      <headers>
        <header ver="2" level="0">
          <columns>
            <column ver="4" id="Id0" name="Id0" index="0" visIndex="0" width="60" filter="Dapfor.Test.Editors.ValueEqualityCheckBoxFilter2" flag="4">
              <filter>
                <ValueEqualityCheckBoxFilter2 valueType="Dapfor.Net.Ui.SortDirection, Dapfor.Net">
                  <values>
                    <value active="true">Undefined</value>
                    <value active="true">Ascending</value>
                    <value active="true">Descending</value>
                  </values>
                </ValueEqualityCheckBoxFilter2>
              </filter>
            </column>
            <column ver="4" id="Id1" name="Id1" index="1" visIndex="1" width="60" flag="0" />
          </columns>
        </header>
      </headers>
    </DapforNetGrid>

     

    Best regards,

    Dapfor

     

    0
  • Michael Sage

    Thanks for your reply, but perhaps I wasn't clear with my earlier question. I see that the new filter is able to load up the list of available values from xml , but is there also a way for me to add to the list of available filter values at runtime.

    For example, suppose I initialize the constructor with 3 values, and then my grid starts populating with data. In the situation where I see a  column value that is not part of the 3 filter values that I have already populated the filter with, is it possible for me to add that value to the filter ? This behaviour is similar to what the earlier filter used to do with exception that instead of starting out with a blank filter, I will be able to initialize it with some known values.

    Thanks.

     

    0
  • Dapfor Team

    Hello,

    The main problem that the grid doesn't know the moment and rules when values should be modified. It's also true when the content is empty.

    Note, there are 2 different instances of the filter.

    • created at the initialization time
    • deserialized from the xml file

    The grid doesn't know what you want to do after deserialization. Nevertheless, the filter is available in the Column.Filter property and for your particular case, you can add public methods/properties to ValueEqualityCheckBoxFilter2 and modify values. If you change them, you should also apply Grid.FilterRefresh() method.

    Regards,

    Dapfor

     

     

     

     

     

    0

Please sign in to leave a comment.

Powered by Zendesk