|
Rank: Member Groups: Member
Joined: 12/9/2010 Posts: 28
|
I have a moderately complex grid including a context menu and a custom column that will add buttons depending on the state of a record (extending the ideas in Custom Column -Advanced4). There is a lot of other stuff going on in the grid, so I don't currently have a minimum demonstration code. When I invoke a function from the context menu (which does work), I am getting a script error (observed in Firebug's script panel) //********************************************************************************************************** // EO.Web Script Library. Copyright (C) 2006-2014 Essential Objects, Inc. All rights reserved. // Visit Us on the Web: http://www.essentialobjects.com// Version: 11.0.60.2 //********************************************************************************************************** d._destroyTree is not a function. Checking the watch window, the 'd' object has a number of functions, but not _destroyTree. Is this an issue with my build of the scripts, or do you need demo code for this?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, Here "d" is ASP.NET AJAX Manager. We get it with this code:
Code: JavaScript
ajaxManager = Sys.WebForms.PageRequestManager.getInstance();
_destroyTree should be a valid method on the returned object both for ASP.NET 2.0 and 4.0. So you may want to check if something has caused getInstance to return a different object, or somehow you have a different version of AJAX Manager that does not have that method. If that's the case, you can try to isolate the problem into a test project and send us the test project. As soon as we have that we will take a look. Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/9/2010 Posts: 28
|
I have created a new site (VS 2012, C#), and replaced the contents of the main page with a variant of the Grid Demo Custom Column - Advanced 4
Code: HTML/ASPX
<script type="text/javascript">
//By default a custom column supports edit. Since
//we don't need to edit this column, so we handle
//ClientSideBeginEdit and always return false to
//prevent the cell enters edit mode
function begin_edit() {
return false;
}
//A custom column allows you to dynamically creates
//cell text. Here we creates HTML links inside the
//cell.
function get_text(column, item, cellValue) {
var ajaxManager = Sys.WebForms.PageRequestManager.getInstance();
console.log(ajaxManager);
var html = "";
//Get the grid object
var grid = eo_GetObject("<%=Grid1.ClientID%>");
if (grid.getEditItem() != item) {
//Create edit button if the current item
//is not in edit mode
html += "<a href='javascript:edit_row(" + item.getIndex() + ")'>";
//Change "Edit" to an image tag if you wish to
//use an image button. For example
//html += "<img src='edit.gif' border='0' />";
html += "Edit";
html += "</a>";
}
else {
//Otherwise create update button
html += "<a href='javascript:edit_row(-1)'>";
//You can use image here. See comment for "Edit" button
html += "Update";
html += "</a>";
}
//Create delete button
html += " <a href='javascript:delete_row(" + item.getIndex() + ")'>";
//You can use image here. See comment for "Edit" button
html += "Delete";
html += "</a>";
return html;
}
function edit_row(rowIndex) {
//Get the grid object
var grid = eo_GetObject("<%=Grid1.ClientID%>");
var item = rowIndex >= 0 ? grid.getItem(rowIndex) : grid.getEditItem();
//Place the item in or out the edit mode. If rowIndex
//is -1, then this function places the current edit
//item out of edit mode (this is the case for "Update"
//button), otherwise it places the item into edit mode
//(this is the case for "Edit" button
grid.editItem(rowIndex);
//The item mode has changed, refresh the cell
var cell = item.getCell(0);
//We don't care about the value for this cell because
//it is only used for command buttons. Call setValue
//force the cell to update
cell.setValue(null);
}
function delete_row(rowIndex) {
//Get the grid object
var grid = eo_GetObject("<%=Grid1.ClientID%>");
//Put the grid into edit mode
grid.deleteItem(rowIndex);
}
function after_edit_item(item) {
setTimeout(function () {
//Get the first cell
var cell = item.getCell(0);
//Update the cell
cell.refresh();
}, 10);
}
</script>
<eo:Grid ID="Grid1" runat="server" Height="180px" Width="500px" AllowColumnReorder="True"
ColumnHeaderDescImage="00050105" ColumnHeaderAscImage="00050104" FixedColumnCount="0"
GoToBoxVisible="True" GridLines="Both" BorderColor="#7F9DB9" GridLineColor="220, 223, 228"
ColumnHeaderDividerImage="00050103" Font-Names="Tahoma" Font-Size="8.75pt" BorderWidth="1px"
KeyField="TopicID" ClientSideAfterEditItem="after_edit_item">
<ItemStyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="background-color: white" />
<ItemHoverStyle CssText="background-color: whitesmoke" />
<SelectedStyle CssText="background-color: #316ac5; color: white" />
<FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right; color: black;" />
<CellStyle CssText="padding-left:8px;padding-top:2px;white-space:nowrap;" />
</eo:GridItemStyleSet>
</ItemStyles>
<ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;" />
<Columns>
<eo:RowNumberColumn>
</eo:RowNumberColumn>
<eo:StaticColumn DataField="Key" HeaderText="Key" Name="Nye">
</eo:StaticColumn>
<eo:StaticColumn DataField="Value" HeaderText="Value" Name="Value">
</eo:StaticColumn>
<eo:CustomColumn Width="100" ClientSideBeginEdit="begin_edit" ClientSideGetText="get_text">
</eo:CustomColumn>
</Columns>
<ColumnTemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
</eo:TextBoxColumn>
<eo:DateTimeColumn>
<DatePicker ControlSkinID="None" DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon">
<PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
<TitleArrowStyle CssText="cursor:hand" />
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
</DatePicker>
</eo:DateTimeColumn>
<eo:MaskedEditColumn>
<MaskedEdit ControlSkinID="None" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
</MaskedEdit>
</eo:MaskedEditColumn>
</ColumnTemplates>
<ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;" />
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
<GoToBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 40px; BORDER-BOTTOM: #7f9db9 1px solid" />
</eo:Grid>
Code: C#
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("I'm a ", "fake record");
data.Add("me", "too");
data.Add("same", "here");
Grid1.DataSource = data;
Grid1.DataBind();
}
}
to observe the AjaxManager without all of the additional stuff in my actual project. The EO Web dll in the /bin/ is product verion 11.0.60.2 modified 05/29/2014 1:00 am This is also not showing the .destroyTree function (or, at least, I'm not seeing it!) when I look into the AjaxManager via FireBug. That said, this may be a bit of a red herring a) I noticed that the 'd._destroyTree is not a function' error was popping up just as my mug occurs (the controls added by get_text vanishing after triggering one of them). This is correlation, but perhaps not the acutal cause. This symptom is not occuring in the example above. b) my actual grid is much more complex -- with many more columns, custom columns, a context menu, and so on and so on. So, I can reproduce the (apparent!) lack of ._destroyTree, but I haven't yet been able to reproduce the (alleged) consequences outside of the complex production code.
|
|
Rank: Member Groups: Member
Joined: 12/9/2010 Posts: 28
|
Code: JavaScript
var ajaxManager = Sys.WebForms.PageRequestManager.getInstance();
ajaxManager._destroyTree();
also fails.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Thanks for the additional information. We have confirmed this to be a problem. We will fix it in our next build.
|
|
Rank: Member Groups: Member
Joined: 12/9/2010 Posts: 28
|
ok. Thank you.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
We have posted a new build that should fix this problem. You can download the new build from our download page. Please take a look and let us know if it resolves the issue for you.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/9/2010 Posts: 28
|
verifying.
I'm currently not seeing an error raised, but I'm also not seeing _destroyTree when inspecting the object, so I'm not sure what I should have been expecting here.
My bug -- where the controls (similar to demo custom column advanced 4) are vanishing after first use or use of the context menu -- persists. As noted, this is in a fairly complex grid (on a moderately complex, multi-grid page), and my problem has not been reproduceable outside of that grid.
So, I will keep investigating.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, The original problem caused by _destroyTree was that this was a method that exists in older version of ASP.NET ajax but no longer exists in newer version. When we perform a callback, we call this function (or it's newer equivalent) to "unload" all controls inside the panel. Since your situation appears after the first update, it appears to have to do with this. The changed we made is to automatically detects ASP.NET AJAX version and calls the corresponding methods instead of always calling _destroyTree. The fact you do not see _destroyTree called is the right behavior, since the function does not exist in your version of ASP.NET ajax. In order for us to look into this further, we will need a test project. You can find test project guidelines here: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Member Groups: Member
Joined: 12/9/2010 Posts: 28
|
1) great to know that it is working as expected. Thanks!
2) I *just* found the underlying cause of the problem (writing the issue out some more led me to it). It turned out that I had multiple grids with the 'row controls' custom column on a page within UserControls. The user controls both contained client side script for ClientSideGetText -- that had the same function name. All worked well when only one user control was on the page at once -- adding the second put two copies of the function onto the page. The latter one tried handling all of the calls after the initial load, but had different logic.
So: do'h!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Ah....that explains....Thanks for letting us know!
|
|