Using Grid in edit window

4 posts, 1 answers
  1. Petr
    Petr avatar
    31 posts
    Member since:
    Jul 2015

    Posted 02 Oct 2018 Link to this post

    Dear all,

    In my application I use Radgrid and customized insert window which contains another Radgrid. The grid contains selection column and user can select multiple records. I have a problem when the user selects any records and close the window without saving. It looks list of selected items remains stored somewhere and when I open window again I have a problem. At first look it looks fine but if I click on 'Select All' checkbox nothing happened. I try to debug it JS and I see values in  _selectedItemsInternal property, but it contains old values (which were selected for the first time before window close).

    I execute JS function when window is closed. So I hope I can remove any selection in this, but I tested a lot of functions:

    grid.clearSelectedItems();
    grid.get_masterTableView().set_visible(false);
    grid.get_masterTableView().set_dataSource([]);
     
    $('[id$="' + grid.ID + '_ClientState"]').val("");
     
    masterGrid.get_masterTableView().cancelInsert();


    But nothing helps me and when I open it again I have always the same problem. The checkbox 'Select All' doesn't work. When I select records manually one by one then it works.

    Do you have any idea what can be wrong with header checkbox or how to clean correctly old values.

    Thank you,
    Petr
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4655 posts

    Posted 04 Oct 2018 Link to this post

    Hi Petr,

    If you set the ReloadOnShow property of the RadWindow to true, it will append a querystring parameter with a random value to the URL and so every time the content (edit) page is fetched, you will have a fresh copy from a GET request. The default behavior of the RadWindow is to simply hide with display:none, so the next time you show it, its state is the same as when closed.


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Petr
    Petr avatar
    31 posts
    Member since:
    Jul 2015

    Posted 05 Oct 2018 Link to this post

    Hi Marin,

    it sounds like a good solution, but I don't know how to set this property for my grid edit window. I just created your own template (MasterTableView.EditFormSettings.FormTemplate) , but I cannot find any settings for window.

     

    Thank you,

    Petr

  4. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    4655 posts

    Posted 05 Oct 2018 Link to this post

    Hello Petr,

    The following demo shows how you can define settings for the RadWindow that contains the custom edit form: https://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window.

    If this is not what you are using, I advise that you open a support ticket and send us a small runnable example that shows the scenario and problem you have so we can investigate, instead of guess.

    The FormTemplate is a custom set of controls and they behave like any other control on the page - their ViewState is tracked, for example, so they will retain selections, for example. If you want to have a highly customized edit form, I recommend you take the approach from the demo above as this will also speed up the main page by dropping a number of postbacks and minimizing the data queries it has to make.


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top