I'm trying to add a WebDialogWindow to the row editing template (by adding it to the template via the designer), but it's only being shown once: when editting a row for the first time. I close the WebDialogWindow with the close button and then start editing the second row, but then the window isn't show. I guess I have to set the windowstate of the WebDialogWindow manually in the "TemplateOpening" event, but I don't know how to get the clientId of the WebDialogWindow (so I can call the show() method on the window).
So my question is: is my assumption right and how do I get the clientId of the WebDialogWindow? Or is there another way to achieve this?
Hi Pieter,
To get access to javascript object of any control (regardless of its location), you should use functions related to that control only. WebDataGrid template or any other container is irrelevant to it.
The $find(ClientID_ofControl) should be used. In case of naming containers, the value of ClientID can be hard to obtain. To get it, you can process ClientEvents.Initialize for that "child" control, and using reference to object within that handler, get its id, save it in a global variable and use that within $find at the time when you need reference.
The Infragistics._Utility class (static variable $util) has a helper function findControl which can work only for Infragistics controls. However, in case of controls with same ids, it will find the first instance only. So, in general case it will fail. If ID of control in your application is unique, then it can be used reliably.
<RowEditingClientEvents TemplateOpening="grid1_templateOpening" />
To ensure visibility of dialog, you may use something like below.
<script type="text/javascript">function grid1_templateOpening(sender, args){ var dialog = $util.findControl('WebDialogInsideRowEdit'); if(!dialog) { alert('WebDialogInsideRowEdit was not found'); return; } if(dialog.get_windowState() != $IG.DialogWindowState.Normal) dialog.set_windowState($IG.DialogWindowState.Normal);}</script>
Victor,
How can I set a behavior programmatically? In this example, you are assigning "grid1_templateOpening" as the "TemplateOpening" handler. What if you had a custom object named "gridCommon" with a method named "templateOpening". I thought it would be <RowEditingClientEvents TemplateOpening="gridCommon.templateOpening" /> I think my problem is that this is being set before the function is defined in the custom object. I would like to set this behavior in the pageLoad() function is ASP.NET AJAX.
Something like thisgridCommon = $create($xyAmp.GridCommon, properties, null, null, null);var wdg = $find(planCodeControls.webDataGridId);gridCommon.set_grid(wdg);
var behaviors = gridCommon.get_grid().get_behaviors();var editCore = behaviors.get_editingCore();var editBehaviors = editCore.get_behaviors();var rowTemplate = editBehaviors.get_rowEditingTemplate();var rowTemplateEvents = rowTemplate.get_events();
I get lost right around here. Do you have any javascript examples to get me up and running? The CSOM documentation is horrendous as I am sure you know. Anyways, I just want to attach my custom component method as the handler using js. How do i accomplish that?
Kind Regards,~ck in San Diego