Hi,
After reading some threads and documentation about the client-side OnPopUpShowing event, I tried to position the popup window right below the edited item (as opposed to centered in the page as discussed in this thread)
I tried using the eventArgs.get_domEvent() function but received the following error : eventArgs.get_domEvent is not a function. My objective was to retrieve the clicked button's image and deduced the position from there. The documentation page about OnPopUpShowing mentions that domEvent is an property of eventArgs though...
Can you suggest an alternative ?
Dominic.
-----
Using version 2009 Q1 SP1 (2009.1.402.35)
After reading some threads and documentation about the client-side OnPopUpShowing event, I tried to position the popup window right below the edited item (as opposed to centered in the page as discussed in this thread)
I tried using the eventArgs.get_domEvent() function but received the following error : eventArgs.get_domEvent is not a function. My objective was to retrieve the clicked button's image and deduced the position from there. The documentation page about OnPopUpShowing mentions that domEvent is an property of eventArgs though...
var popUp; | |
function PopUpShowing(sender, eventArgs) | |
{ | |
var domEvent = eventArgs.get_domEvent(); | |
var target = domEvent.target; | |
... | |
} |
Can you suggest an alternative ?
Dominic.
-----
Using version 2009 Q1 SP1 (2009.1.402.35)
8 Answers, 1 is accepted
0
ManniAT
Top achievements
Rank 2
answered on 23 Apr 2009, 08:46 PM
Hi,
I'm not very clear why you want to get the dom_Event and then the target (which I guess you expect to be the Popup).
Fact is, that eventarg gives you two things in this case - access to cancel - and via "get_popUp" access to the Popup.
And sender gives you access to the grid itself.
By the way - I took a look at the thread you linked - I could not find any code (of course) which uses get_domElement().
Regards
Manfred
I'm not very clear why you want to get the dom_Event and then the target (which I guess you expect to be the Popup).
Fact is, that eventarg gives you two things in this case - access to cancel - and via "get_popUp" access to the Popup.
And sender gives you access to the grid itself.
By the way - I took a look at the thread you linked - I could not find any code (of course) which uses get_domElement().
Regards
Manfred
0
dstj
Top achievements
Rank 1
answered on 23 Apr 2009, 08:53 PM
Hi Manfred, thanks for the reply,
Did you check the documentation page I linked to (http://www.telerik.com/help/aspnet-ajax/onpopupshowing.html) ?
Here's an excerpt :
As mentioned, I had hoped the DOM event's target would be the button clicked, not the popup itself, but the actual element clicked to cause the popup to open. With that DOM element, I would be able to get its actual position on the screen and then position the popup accordingly...
Note, it's domEvent, not domElement in the documentation. So my question really is two-fold :
1- Is the documentation incorrect or am I reading it wrong ?
2- How can I position the popup relative to the edited row ?
Thanks,
Dominic.
Did you check the documentation page I linked to (http://www.telerik.com/help/aspnet-ajax/onpopupshowing.html) ?
Here's an excerpt :
Arguments
popUp - html element of the pop-up edit form
domEvent - dom event
As mentioned, I had hoped the DOM event's target would be the button clicked, not the popup itself, but the actual element clicked to cause the popup to open. With that DOM element, I would be able to get its actual position on the screen and then position the popup accordingly...
Note, it's domEvent, not domElement in the documentation. So my question really is two-fold :
1- Is the documentation incorrect or am I reading it wrong ?
2- How can I position the popup relative to the edited row ?
Thanks,
Dominic.
0
ManniAT
Top achievements
Rank 2
answered on 23 Apr 2009, 09:40 PM
Follow up:
If you want to handle the edit button yourself (custom button) you can (from the Button client handler) bring your Item into EditMode with this function: http://www.telerik.com/help/aspnet-ajax/grid_edititem.html
So you get your button's attributes in your "private function" - and can save it for later use in OnPopUpShowing.
If you want to handle the edit button yourself (custom button) you can (from the Button client handler) bring your Item into EditMode with this function: http://www.telerik.com/help/aspnet-ajax/grid_edititem.html
So you get your button's attributes in your "private function" - and can save it for later use in OnPopUpShowing.
0
ManniAT
Top achievements
Rank 2
answered on 23 Apr 2009, 10:55 PM
Jep, I'v seen this domEvent sometimes in documentation - I ignored it :)
I could not find a method to retrive the currently edited element from client code.
There is a sample here http://www.telerik.com/community/forums/aspnet-ajax/grid/dataitem-is-in-editmode-on-client-side.aspx but for my approach this was to much.
If you can get the dataitem (you'r editing at the moment) you won - there is http://www.telerik.com/help/aspnet-ajax/grid_control_row.html get_element() which gives you access to the table row - finding the button from there would mean nothing.
If no one has a better idea - I would use a hidden field to save my current edit index.
With this you can access the element in your OnShowPopup.
So on Server
On client:
I wanted to show a working solution -- my problem at the moment -- get_masterTableView() always returns null - except I call it in a "OnCommand" handler - there it works!!
But I guess this is a fault of my "rough and dirty" test project.
Regards
Manfred
I could not find a method to retrive the currently edited element from client code.
There is a sample here http://www.telerik.com/community/forums/aspnet-ajax/grid/dataitem-is-in-editmode-on-client-side.aspx but for my approach this was to much.
If you can get the dataitem (you'r editing at the moment) you won - there is http://www.telerik.com/help/aspnet-ajax/grid_control_row.html get_element() which gives you access to the table row - finding the button from there would mean nothing.
If no one has a better idea - I would use a hidden field to save my current edit index.
With this you can access the element in your OnShowPopup.
So on Server
protected void rgTest_EditCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { |
hfEditItem.Value= e.Item.ItemIndex.ToString(); |
} |
function OnShowPop(sender, args) { |
var hfVal = document.getElementById(("<%= hfEditItem.ClientID %>")); |
var rGrid = $find("<%= rgTest.ClientID %>"); |
var rMaster = rGrid.get_masterTableView(); |
var el=rMaster.get_dataItems()[hfVal.value].get_element(); |
//el is the table row... |
} |
... |
<asp:HiddenField ID="hfEditItem" runat="server" /> |
But I guess this is a fault of my "rough and dirty" test project.
Regards
Manfred
0
dstj
Top achievements
Rank 1
answered on 01 May 2009, 02:25 PM
Thanks for your suggestion. But, can someone from Telerik confirm that the get_domEvent() specified in the documentation is not implemented properly?
Is there any intention of fixing the API (or the doc), that would help me orient my solution.
Thanks,
dstj.
Is there any intention of fixing the API (or the doc), that would help me orient my solution.
Thanks,
dstj.
0
ManniAT
Top achievements
Rank 2
answered on 03 May 2009, 04:42 PM
Hi dstj,
simply use the debugger and take a look at args with this call.
You'll see that you can get only "get_cancel, set_cancel and get_popUp" from this parameter.
And my "idea" will also not work - since get_mastTableView is not working in this case.
Take a look at this thread: http://www.telerik.com/community/forums/aspnet-ajax/grid/get-mastertableview-not-always-working.aspx
Regards
Manfred
simply use the debugger and take a look at args with this call.
You'll see that you can get only "get_cancel, set_cancel and get_popUp" from this parameter.
And my "idea" will also not work - since get_mastTableView is not working in this case.
Take a look at this thread: http://www.telerik.com/community/forums/aspnet-ajax/grid/get-mastertableview-not-always-working.aspx
Regards
Manfred
0
dstj
Top achievements
Rank 1
answered on 03 May 2009, 08:32 PM
My question for the Telerik dev team remains (you really can't help me there): is the API wrong or the documentation wrong, they contradict themselves? Which one will be fixed?
0
Hello Dominic,
I am afraid that it was the documentation that misleaded you. There is no domEvent in the arguments.
We will fix the documentation immediately.
Greetings,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I am afraid that it was the documentation that misleaded you. There is no domEvent in the arguments.
We will fix the documentation immediately.
Greetings,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.