ext treestore auload失效问题
来源:互联网 发布:mp5刷机软件 编辑:程序博客网 时间:2024/05/11 12:04
- Products
- Support
- Training
- Company
- Blog
- Contact
- Store
- Log in / Register
- Forum
- App Gallery
- Learn
- Documentation
Forum / Ext JS Community Forums 4.x / Ext: Q&A /
autoLoad: false TreeStore in with TreePanel rootVisible: false
- 13 Mar 2012 1:10 PM#1Sencha User
- Join Date
- Sep 2010
- Location
- Curitiba - PR / Brasil
- Posts
- 214
- Vote Rating
- 0
- Answers
- 8
0Unanswered: autoLoad: false TreeStore in with TreePanel rootVisible: false
Hello, I understand the idea of autoLoad: false TreeStore the "no work" or work differently due to the expansion of the root. But if you do not want to display this root, there's no way I set it so that it is not expanded, since it is hidden. The main problem is I need to load the tree after it is rendered, but it strikes me the following error:
Moreover, it tries to create new nodes instead of removing the existing and doing a "reload" menu.To better illustrate the problem, I created the example below.Code:records[i] is undefined...ns[i].viewRecordId = records[i].internalId;
menu.jsonCode:<!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../resources/css/ext-all.css" type="text/css"> <script type="text/javascript" src="../ext-all-dev.js"></script> <script type="text/javascript"> Ext.define('Menu', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'int'}, 'text', 'leaf' ], proxy : { type : 'ajax', url : 'menu.json', reader: {type: 'json'}, } }); Ext.onReady(function() { var store = Ext.create('Ext.data.TreeStore', { model : 'Menu', autoLoad: true }); Ext.create('Ext.tree.Panel', { renderTo : Ext.getBody(), height : 100, store : store, rootVisible: false }); store.load(); }); </script> </head> <body> </body></html>
Ext JS 4.0.7Code:[{ id : 1, text: 'Menu 1', leaf: true},{ id : 2, text: 'Menu 2', leaf: true}]
Thank you!Automatic Generator of Applications Ext JS 4Reply With Quote - 14 Mar 2012 9:46 AM#2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 27,805
- Vote Rating
- 325
- Answers
- 2533
0If you wanted to stop the loading you can return false in a beforeload event listener. Then to load you can do
Code:store.load({ node : rootnode});
Mitchell Simoens
Sencha Inc, Senior Forum Manager
@SenchaMitch
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription.https://www.sencha.com/store/
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in heavy development! Several chapters already available!Reply With Quote - 14 Mar 2012 10:06 AM#3Sencha User
- Join Date
- Sep 2010
- Location
- Curitiba - PR / Brasil
- Posts
- 214
- Vote Rating
- 0
- Answers
- 8
0As specifically stop load? return false just before the load is not going to stop .. I do not understand your code .. I put in the rootnode, if I do not want the menu has a root?
Automatic Generator of Applications Ext JS 4Reply With Quote - 14 Mar 2012 10:11 AM#4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 27,805
- Vote Rating
- 325
- Answers
- 2533
0then...Code:store.on('beforeload', function() { return false; });
Code:store.load({ node : store.getRootNode()});
Mitchell Simoens
Sencha Inc, Senior Forum Manager
@SenchaMitch
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription.https://www.sencha.com/store/
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in heavy development! Several chapters already available!Reply With Quote - 14 Mar 2012 10:53 AM#5Sencha User
- Join Date
- Sep 2010
- Location
- Curitiba - PR / Brasil
- Posts
- 214
- Vote Rating
- 0
- Answers
- 8
0Code:Ext.define('Compstoque.view.Menu' ,{ extend : 'Ext.tree.Panel', alias : 'widget.mainmenu', region : 'west', title : 'Menu', width : 200, minWidth : 150, maxWidth : 400, split : true, collapsible: true, store : 'Menu', rootVisible: false});
Code:Ext.define('Compstoque.store.Menu', { extend: 'Ext.data.TreeStore', model : 'Compstoque.model.Modulo'});
not really loads the menu, but he keeps doing the requests, including a need to "reload" on the menu with other data, but is not occurring. Even several requests being made unnecessarily. In short, I want to load the menu in store only at render, this method LoadMenu, but I'm not getting.Code:...'mainmenu' : { render : me.loadMenu, ... },...loadMenu: function(tree) { var store = tree.getStore(); store.on('beforeload', function() {return false;}); store.load({ node : store.getRootNode() }); },
store.jpgAutomatic Generator of Applications Ext JS 4Reply With Quote
+ Reply to Thread
- ext treestore auload失效问题
- ext treestore 自动加载问题
- 关于Ext的TreeStore会第一次默认加载的问题
- Ext.data.TreeStore
- EXTJS4 Ext.data.TreeStore model
- 前台ext treestore id重复的解决方法。
- Ext利用TreeStore构建动态菜单
- Ext.selection.CheckboxModel全选失效问题
- ExtJs中 Data.TreeStore 字段的问题
- Extjs TreeStore无限制加载数据的问题
- Ext.grid.GridPanel 的 loadMask 失效问题的解决
- 解决Ext.form.TextField的 maxLength 属性失效问题
- Ie9 ext tree 失效
- Extjs4 重写Ext.data.TreeStore的load方法,不使多次加载
- 在Ext的JsonStore的load方法中使用回调callback 修改treeStore 数据
- extjs TreeStore
- Ext Gantt 3.*解决任务部分鼠标滚轮失效问题的方法
- ext问题
- unicode码表 及 unicode转utf8规则
- C++ 非类型参数的模版实参
- hdu1026
- jQuery 事件 - delegate() live() 方法
- 谈新手修练J2EE武功及学SSH的方法
- ext treestore auload失效问题
- 人工关节置换与康复
- 百度文库(菜鸟版前身)
- 取得电信网络和手机的相关信息之TelephonyManager与android.provider.settings.System
- 进程和线程的区别
- android之屏幕方向改变以及onConfigurationChanged事件
- 关于淘宝的数据库系统
- 电子表示例
- gt-grid bug