This is a migrated thread and some comments may be shown as answers.

Using Grid in edit window

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Petr
Top achievements
Rank 1
Iron
Petr asked on 02 Oct 2018, 11:50 AM
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

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 04 Oct 2018, 02:34 PM
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.
0
Petr
Top achievements
Rank 1
Iron
answered on 05 Oct 2018, 07:14 AM

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

0
Accepted
Marin Bratanov
Telerik team
answered on 05 Oct 2018, 01:30 PM
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.
Tags
Grid
Asked by
Petr
Top achievements
Rank 1
Iron
Answers by
Marin Bratanov
Telerik team
Petr
Top achievements
Rank 1
Iron
Share this question
or