PDA

View Full Version : Using Examples



roman.buzuk
22 Nov 2012, 12:15 AM
Sorry for mistakes in English.
I am trying to use example from Drag and Drop betweens two TreePanels (http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/tree/two-trees.html), but it isn`t working good. When I try to expand folders or drag, I receive error that 'internalId' is null or not object'.
I`m using ASP.NET.
It is code of webform


<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TestTree.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<link rel="stylesheet" type="text/css" href="js/resources/css/ext-all.css" />
<!-- GC -->
<script type="text/javascript" src="js/ext-all.js"></script>
<style type="text/css">
#tree, #tree2 {
float: left;
margin: 20px;
}
</style>
<script type="text/javascript" language="javascript">
Ext.require(['*']);


Ext.onReady(function () {
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'aaa.php'
},
root: {
text: 'Ext JS',
id: 'src',
expanded: true
},
folderSort: true,
sorters: [{
property: 'text',
direction: 'ASC'
}]
});


var tree = Ext.create('Ext.tree.Panel', {
id: 'tree',
store: store,
width: 250,
height: 300,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
appendOnly: true
}
},
renderTo: 'ftree'
});


var store2 = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'aaa.php'
},
root: {
text: 'Custom Ext JS',
id: 'src',
expanded: true,
children: []
},
folderSort: true,
sorters: [{
property: 'text',
direction: 'ASC'
}]
});


var tree2 = Ext.create('Ext.tree.Panel', {
id: 'tree2',
width: 250,
height: 300,
store: store2,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
appendOnly: true
}
},
renderTo: 'ftree'
});
});
</script>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"><div id="ftree" /></asp:PlaceHolder>
</asp:Content>

File `aaa.php` is copy of file 'get-nodes.php' from example. Can you explain me, where is error and how to fix it?

mitchellsimoens
23 Nov 2012, 1:09 PM
What Ext JS 4.x.x version are you using?

roman.buzuk
25 Nov 2012, 10:01 PM
4.1.1
As I understand, problem is that, when node is expanded, tree is loaded again. How can I deny that?

mitchellsimoens
26 Nov 2012, 5:45 AM
If a node (not a leaf) has no children specified, it will try to load it via the tree store's proxy. If you give it an empty array, children : [], it shouldn't try to load children.

roman.buzuk
28 Nov 2012, 12:26 AM
Thanks, problem is solved.