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

Sending extra data to popup editor

8 Answers 681 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 28 Jul 2017, 07:03 PM
I know we can send additional data to the read event, but is there a mechanism for sending additional data to the popup edit screen?

8 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 01 Aug 2017, 10:58 AM
Hi Joe,

The edit event is fired when user edits or creates a data item. The property e.container holds the popup window and its possible to modify it.

The following dojo sample illustrates how to modify the popup window when user edits a data item:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Joe
Top achievements
Rank 1
answered on 01 Aug 2017, 04:09 PM
That's great for modifying the window, but what if I want to pass it an object, or a collection of objects?
0
Georgi
Telerik team
answered on 03 Aug 2017, 11:45 AM
Hello Joe,

Could you please provide us more detailed information of the scenario and what you are trying to achieve? So I can provide a solution for the exact case.

The popup can be customized, please refer to the following project which illustrates how to customize the popup edit window:


The only event that allows you to intercept the popup instantiation is edit.

Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Joe
Top achievements
Rank 1
answered on 03 Aug 2017, 02:22 PM
I have a grid that has rows in it, and when I click the Edit button, only that rows data is available in the edit popup.  I also want to send some ancillary data to the popup as well that is not part of the record itself.  In the specific case, the edit is for setting a percentage as a fee, and the ancillary data I wish to make available to the edit window is their fee history, for validation.  So if they set a percentage that is already in use, I can disallow the edit, and set the previously used fee as the active fee.
0
Georgi
Telerik team
answered on 07 Aug 2017, 12:44 PM
Hi Joe,

A possible solution is to request the fees history from the server using jQuery AJAX  when the edit event is fired. This way the ancillary data will by accessible within the popup window.

In case the additional data is requested with the current page, another solution is to store the data inside a hidden input and retrieve it when edit event is fired using jQuery.

Since there is no built in functionality for passing additional data to the edit popup window, please give a try to the aforementioned approaches and let me know if they work for you.  


Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Chung On
Top achievements
Rank 1
answered on 09 Aug 2017, 08:09 AM

Hi Georgi,

  Can we use the grid edit event fire a Ajax call to get more data from database, store in the model and render in the popup editor for user updating?

Regards,

  On

0
Joe
Top achievements
Rank 1
answered on 09 Aug 2017, 02:42 PM

>> A possible solution is to request the fees history from the server using jQuery AJAX  when the edit event is fired. This way the ancillary data will by accessible within the popup window.

I'm curious about this...  I can pull the data (it's actually already available in the javascript), but the edit window is bound to the model of the grid.  How do I make this ancillary data available?  How would I actually use it in the popup edit form?  For the record, I do have my own popup edit form I put together for this,it uses the model that is bound to the grid, there's no place to put ancillary data.  So how do I make use of it in the popup?

0
Georgi
Telerik team
answered on 11 Aug 2017, 07:20 AM
Hello,

Chung, yes it is possible to request more data when edit event is fired and use it in the popup editor. I have assembled small sample which requests data when the edit event is fired and uses the result as dataSource for drop down editor:


Joe, since the data is already available in the javascript I suggest you to use validation. In other words add a validation rule that checks whether the new value is already contained in the ancillary data:


You can find more information about validation in the following demo:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Joe
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Joe
Top achievements
Rank 1
Chung On
Top achievements
Rank 1
Share this question
or