PDA

View Full Version : [CLOSED] [#680] Migration of TreeGrid from Ext 2.5.3 to 3.0.0



IMehl
Feb 04, 2015, 10:42 AM
Hi,

i have an TreeGrid with CellEditing Plugin. With Ext Version 2.5.3 it work fine, but not with Version 3.0.0.
After migration i have two problems:

a) contextmenu is not visible



<Plugins>
<ext:CellEditing runat="server" ClicksToEdit="1">
<Listeners>
<BeforeEdit Handler="return beforeCellEditHandler(e);"></BeforeEdit>
</Listeners>
</ext:CellEditing>
</Plugins>
<View>
<ext:TreeView runat="server" StripeRows="true" TrackOver="true" >
<Listeners>
<CellContextMenu Fn="showContextMenu" StopEvent="true" />
</Listeners>
<GetRowClass Fn="getRowClass" />
</ext:TreeView>
</View>

The contextmenu will not be visible, editor starts on click event. It doesnt matter if right or left click.
If i set the "ClicksToEdit=2" then the contextmenu will be visible.

Is there a possibilty to change the value back to 1 with the old behavior?

b) editingPlugin is undefined

Also after migration i cannot use the editingPlugin for access to the record



<ext:Column runat="server" ID="cStatus" Text="Status" DataIndex="Status" Width="100" >
<Editor>
<ext:ComboBox runat="server" ID="edtStatus" DisplayField="coStatus" TriggerAction="All" AllowBlank="false" ValueField="coStatus" Hidden="true">
<Store>
<ext:Store runat="server" ID="cboStatusStore">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="coStatus" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<DirectEvents>
<BeforeQuery OnEvent="cboStatus_BeforeQuery">
<ExtraParams>
<ext:Parameter Name="OTHERFIELD" Value="#{TreeGrid1}.editingPlugin.context.record.data.OTH ERFIELD" Mode="Raw" />
</ExtraParams>
</BeforeQuery>
</DirectEvents>
</ext:ComboBox>
</Editor>
</ext:Column>


I get the Message: TypeError: App.TreeGrid1.editingPlugin is undefined
Is there a new synatx for data access?

best regards
I.

Daniil
Feb 04, 2015, 4:56 PM
Hi @IMehl,

a) Please provide a full test case to reproduce the issue. You can provide a working v2 example and we could try to migrate it to v3.

b) Please start a new forum thread. It is best to keep one issue per thread.

IMehl
Feb 05, 2015, 9:09 AM
Hi Daniil,

see the following sample.

If you complie it with Ext.Net.dll Version 2.5.3 the left click executes the editor and the right click the contextmenu.
if you compile the same with ext.net.dll 3.0.0 then the error above appears.

for the second error i post a new thread.

best regards
I.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>TreeGrid - Ext.NET Examples</title>

<script runat="server">

protected void OpenURL(object sender, DirectEventArgs e)
{
// Do something
}


</script>

<link href="/resources/css/examples.css" rel="stylesheet" />

<script>
var formatHours = function (v) {
if (v < 1) {
return Math.round(v * 60) + " mins";
} else if (Math.floor(v) !== v) {
var min = v - Math.floor(v);
return Math.floor(v) + "h " + Math.round(min * 60) + "m";
} else {
return v + " hour" + (v === 1 ? "" : "s");
}
};

var handler = function (grid, rowIndex, colIndex, actionItem, event, record, row) {
Ext.Msg.alert('Editing' + (record.get('done') ? ' completed task' : ''), record.get('task'));
};

var showContextMenu = function (view, cell, cellIndex, record, row, rowIndex, e) {

var menu = App.CalcContextMenu;
menu.Node_TASK = record.get("task");

menu.showAt([e.getXY()[0], e.getXY()[1]]);
e.stopEvent();
}

var beforeCellEditHandler = function (e) {

if (e.column.dataIndex == "user") {
return true;
}
else {
return false;
}

}

</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Menu ID="CalcContextMenu" runat="server">
<Items>
<ext:Label ID="Node_TASK" runat="server" Hidden="true" />
<ext:MenuSeparator Hidden="true" />
<ext:MenuItem runat="server" Text="Do Action" Icon="Accept">
<DirectEvents>
<Click OnEvent="OpenURL" />
</DirectEvents>
</ext:MenuItem>
</Items>
</ext:Menu>

<ext:TreePanel
runat="server"
Title="Core Team Projects 2.5.3"
Width="500"
Height="300"
Collapsible="true"
UseArrows="true"
RootVisible="false"
MultiSelect="true"
SingleExpand="true"
FolderSort="true">
<Store>
<ext:TreeStore runat="server" ID="Store1">
<Proxy>
<ext:PageProxy />
</Proxy>
<Model>
<ext:Model runat="server" IDProperty="_ID" Name="Model1" ClientIdProperty="_ID">
<Fields>
<ext:ModelField Name="task" />
<ext:ModelField Name="user" />
<ext:ModelField Name="duration" />
<ext:ModelField Name="done" Type="Boolean" />
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<Plugins>
<ext:CellEditing runat="server" ClicksToEdit="1">
<Listeners>
<BeforeEdit Handler="return beforeCellEditHandler(e);"></BeforeEdit>
</Listeners>
</ext:CellEditing>
</Plugins>
<View>
<ext:TreeView runat="server" StripeRows="true" TrackOver="true">
<Listeners>
<CellContextMenu Fn="showContextMenu" StopEvent="true" PreventDefault="false" />
</Listeners>
</ext:TreeView>
</View>
<SelectionModel>
<ext:TreeSelectionModel runat="server" Mode="Single">
</ext:TreeSelectionModel>
</SelectionModel>
<ColumnModel>
<Columns>
<ext:TreeColumn
runat="server"
Text="Task"
Flex="2"
Sortable="true"
DataIndex="task" />
<ext:TemplateColumn
runat="server"
Text="Duration"
Flex="1"
Sortable="true"
DataIndex="duration"
Align="Center">
<Template runat="server">
<Html>
{duration:this.formatHours}
</Html>
<Functions>
<ext:JFunction Name="formatHours" Fn="formatHours" />
</Functions>
</Template>
</ext:TemplateColumn>
<ext:Column
runat="server"
Text="Assigned To"
Flex="1"
Sortable="true"
DataIndex="user">
<Editor>
<ext:TextField runat="server" ID="edtUser" />
</Editor>
</ext:Column>
</Columns>

</ColumnModel>

<Root>
<ext:Node Text="Tasks">
<Children>
<ext:Node Icon="Folder" Expanded="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
<ext:ConfigItem Name="duration" Value="13.25" />
<ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
</CustomAttributes>
<Children>
<ext:Node Icon="Folder" Expanded="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Housewares" Mode="Value" />
<ext:ConfigItem Name="duration" Value="1.25" />
<ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
</CustomAttributes>
<Children>
<ext:Node Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Kitchen supplies" Mode="Value" />
<ext:ConfigItem Name="duration" Value="0.25" />
<ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
</CustomAttributes>
</ext:Node>
<ext:Node Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Groceries" Mode="Value" />
<ext:ConfigItem Name="duration" Value="0.4" />
<ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
<ext:ConfigItem Name="done" Value="true" Mode="Raw" />
</CustomAttributes>
</ext:Node>
<ext:Node Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Cleaning supplies" Mode="Value" />
<ext:ConfigItem Name="duration" Value="0.4" />
<ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
</CustomAttributes>
</ext:Node>
<ext:Node Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Office supplies" Mode="Value" />
<ext:ConfigItem Name="duration" Value="0.2" />
<ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
</CustomAttributes>
</ext:Node>
</Children>
</ext:Node>
</Children>
</ext:Node>
</Children>
</ext:Node>
</Root>
</ext:TreePanel>
</form>
</body>
</html>

Daniil
Feb 05, 2015, 10:36 AM
Thank you for the test case!

Created an Issue:
https://github.com/extnet/Ext.NET/issues/680

Fixed in the revision #6314 (trunk). It goes to 3.1.0 beta.

By the way, if you just started to migrate to 3.0 and didn't go too far, we would highly recommend you to use the latest Ext.NET sources from SVN trunk (upcoming 3.1). It fixed lots of issues discovered in 3.0.