FlexGrid for LightSwitch

Reseting User Saved Settings

  •  kneitzel1p said 8 months ago:

    Hi,

    Flexgrid offers the option that the user settings are saved e.g. sort, move, resize, filter actions.

    Is it possible to not save the filter settings of the user? Or to clear the filter settings with some lines of code?

    With kind regards,

    Konrad

  •  Justin Mack4p said 8 months ago:

    Hi Konrad,

    You are able to do this through the properties window of the FlexGrid. There is a checkbox under the advanced tab labeled "Save User Settings" (shown in the attached screenshot) that will allow or disallow the user to save the changes.

    Regards,
    Justin

    Attachments:
    You must be logged in to view attched files.
  •  kneitzel1p said 8 months ago:

    Hi Justin,

    thank you for your reply.

    I know that setting but it is not what I am seeking.

    The requirements are:
    - changes like moved or rezised colums must be saved
    - filters must NOT be saved
    - filters must be available (so it cannot be disabled)

    So when the screen is opened, I want to remove the filters.

    I am able to get the silverlight control but I have no idea how to set the filters. (The C1FlexGrid class seems not to have a way to get the C1FlexGridFilter instance or I simply missed it.)

    It would be great if you could point me towards a solution.

    With kind regards,

    Konrad

  •  Justin Mack4p said 7 months, 4 weeks ago:

    Hi Konrad,

    Thank you for the clarification. I do not see a way to grab the FlexGrid filter and clear it upon screen start as it stands currently. I will be looking into this more and will update you when I have more information.

    Regards,
    Justin

  •  Justin Mack4p said 7 months, 4 weeks ago:

    Hi Konrad,

    After discussing this with the development team, as it stands right now this is not possible with the current release of the control. You should have the ability to select which individual user settings you want to save in the next release. I will update this post when it is available.

    Regards,
    Justin

  •  kneitzel1p said 7 months, 3 weeks ago:

    Hi Justin,

    thank you for your feedback. Maybe I found a workaround – maybe you could discuss if I missed something or not?

    What I did was:
    - I deactivated the filter feature on the C1FlexGrid
    - In my code I get the C1FlexGrid control and create a C1FlexGridFilter instance:

    partial void Screen_Created()
    {
    // Get the main grid
    IContentItemProxy proxy = this.FindControl("grid");
    proxy.ControlAvailable += ProxyControlAvailable;
    }

    private C1.Silverlight.FlexGrid.C1FlexGrid _grid = null;
    private C1.Silverlight.FlexGrid.C1FlexGridFilter _filter = null;
    void ProxyControlAvailable(object sender, ControlAvailableEventArgs e)
    {
    _grid = e.Control as C1.Silverlight.FlexGrid.C1FlexGrid;
    _filter = new C1FlexGridFilter(_grid);
    }

    In my tests I was able to get the behaviour I wanted: Everything was saved (e.g. positions, sortings, …) except the Filters that people set. (That is important in our application to make sure that nobody misses important data because of a filter that is still active from a use in the past.)

    Thank you in advance for your reply.

    With kind regards,

    Konrad

  •  Justin Mack4p said 7 months, 3 weeks ago:

    Hello Konrad,

    I was not able to get the desired behavior when I attempted this using the same methods. If this method is working for you, feel free to use it as a workaround as I see no issues with the implementation. This will not be necessary in the next release version as described above.

    Thank you for the input!

    Regards,
    Justin

  •  kneitzel1p said 6 months, 3 weeks ago:

    Just as a followup. We found some problems with my workaround I had investigated so far so I spend some more time. And I simply missed a lot – there is quite an easy way to get exactly what I need.

    1) I enable filtering inside the designer. No need to create the C1FlexGridFilter on my own!
    2) I get the grid as described before (FindControl + ControlAvailable Event).
    3) Inside the event handler, I can simply do:
    void ProxyControlAvailable(object sender, ControlAvailableEventArgs e)
    {
    _grid = e.Control as C1FlexGrid;
    _filter = C1FlexGridFilterService.GetFlexGridFilter(_grid);
    _filter.Clear();
    _filter.Apply();
    }

    => So I use the C1FlexGridFilterService to get the C1FlexGridFilter instance
    => I clear the filter
    => I apply the change

    So when opening a screen with a saved filter you can see for a very short moment that the grid comes up with a filter set which is directly removed.

    This solution seems to run fine but the full test cycle of the application will start tomorrow …

    Just in case someone else reads the thread.

    With kind regards,

    Konrad

    Answer
  •  phrezil said 2 months, 3 weeks ago:

    Is there an update to this now that a new release has been made?

    I have exactly the same requirements ie Users do not wish to reuse filters applied in previous sessions.

    The workaround suggested above does not seem to work as the _filter object evaluates to null even though a filter exists. Is this a consequence of using a newer C1 Flex grid version 1.0.20123.28 ?

  •  kneitzel1p said 2 months, 3 weeks ago:

    Hi,

    I have to confess that I am still using 1.0.20122.25.

    _filter is null when I deactivate filtering inside the designer. I had this problem once because my first workaround was to disable filtering in the designer and add a filter in code. So when I had to apply this workaround to a new screen I had such an error, too.

    I will check now, if I can grab this update and check if it is still working for me. And if you want we could double check why the workaround is not working for you. Feel free to send me an email: konrad at neitzel dot de. (Maybe my description is missing some important thing – Justin was unable to follow my description, too. I cannot promise anything but I am willing to give it a try.)

    With kind regards,

    Konrad

  •  kneitzel1p said 2 months, 3 weeks ago:

    Hi,

    I just got the latest version (1.0.20123.31) and it still works fine for me. I created a word document where I documented the steps that I did.

    With kind regards,

    Konrad

    Attachments:
    You must be logged in to view attched files.
  •  kneitzel1p said 2 months, 3 weeks ago:

    Hi all,

    I got the NullReferenceException on the _filter now, too. Not sure why my first test was successfull. Either it was still using the old version for some reason or it is a racing condition.

    Without deeper testing, I changed the code to this code:
    void ProxyControlAvailable(object sender, ControlAvailableEventArgs e)
    {
    if (_grid == null)
    {
    _grid = e.Control as C1FlexGrid;
    _grid.EnableFiltering(true);
    _filter = C1FlexGridFilterService.GetFlexGridFilter(_grid);
    _filter.Clear();
    _filter.Apply();
    }
    }

    It seems to work now – but I didn’t test it much. Maybe I was just lucky again in case it was a racing condition. Maybe you can test this _grid.EnableFiltering(true); call, too.

    If my tests in the next week are still successfull then I update the word document I uploaded in my other reply.

    With kind regards,

    Konrad

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

You must be logged in to reply to this topic.