标签: extjs4

Ext.loader未启用缺少必需的?

我在Extjs4 librairie上遇到了一些问题.我想使用treeEditor组件.

Firebug错误:

错误:未捕获的异常:未启用Ext.Loader,因此无法动态解析依赖项.缺少必需的类:Ext.tree.TreeNode

我的代码:

Ext.require([

'Ext.form.*',
'Ext.grid.*',
'Ext.tree.*',
'Ext.data.*',
'Ext.util.*',
'Ext.loader.*',
'Ext.state.*',
'Ext.layout.container.Column',
'Ext.tab.TabPanel'

]);

Ext.onReady(function(){

    // shorthand
    Ext.QuickTips.init();


    var tree = Ext.create('Ext.tree.TreePanel', {
            animate:false,
            enableDD:false,
    //      loader: new Tree.TreeLoader(), // Note: no dataurl, register a TreeLoader to make use of createNode()
            lines: true,
            rootVisible:false,
        //  selModel: new Ext.tree.MultiSelectionModel(),
            containerScroll: false
    });

        // set the root node
        var root = Ext.create('Ext.tree.TreeNode',{
            text: 'Autos',
            draggable:false,
            id:'source'
        });

        tree.on('contextmenu',showCtx);
        tree.on('click',function(node,e){node.select();return false;});
        // json data describing the tree

        var json = [ …
Run Code Online (Sandbox Code Playgroud)

extjs4

19
推荐指数
1
解决办法
4万
查看次数

使用Ext.define()扩展网格面板时如何添加行双击事件侦听器?

我正在使用Ext.define()(Ext v4)扩展GridPanel.

双击网格行时,我需要获取行数据.此时我甚至无法让事件监听器工作:

Ext.define('Application.usersGrid', {
extend: 'Ext.grid.GridPanel',
alias: 'widget.usersgrid',


viewConfig: {
    listeners: {
        dblclick: function(dataview, index, item, e) {
            alert('dblclick');
        }
    }
},
...
Run Code Online (Sandbox Code Playgroud)

这有什么不对?

如果有人需要答案 - 这是正确的方法:

Ext.define('Application.usersGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.usersgrid',


viewConfig: {
    listeners: {
        itemdblclick: function(dataview, record, item, index, e) {
            alert('itemdblclick');
        }
    }
},
...
Run Code Online (Sandbox Code Playgroud)

http://dev.sencha.com/new/ext-js/4-0/api/Ext.grid.GridView#event-itemdblclick

javascript extjs gridpanel extjs4

18
推荐指数
1
解决办法
4万
查看次数

如何在ExtJs 4中获取REST响应消息?

我正在构建ExtJs 4的RESTFul Store示例.当Add或Delete请求失败时,我希望我的脚本显示REST服务器提供的错误.我已设法获取请求的成功状态(请参阅下面的代码),但我如何获得响应提供的消息?

商店:

    var store = Ext.create('Ext.data.Store', {
    model: 'Users',
    autoLoad: true,
    autoSync: true,
    proxy: {
        type: 'rest',
        url: 'test.php',
        reader: {
            type: 'json',
            root: 'data',
            model: 'Users'
        },
        writer: {
            type: 'json'
        },
        afterRequest: function(request, success) {
            console.log(success); // either true or false
        },
        listeners: { 
            exception: function(proxy, response, options) {

                // response contains responseText, which has the message
                // but in unparsed Json (see below) - so I think 
                // there should be a better …
Run Code Online (Sandbox Code Playgroud)

rest extjs extjs4

17
推荐指数
1
解决办法
2万
查看次数

具有远程过滤器和排序的ExtJS无限滚动网格

在ExtJS 4.1 beta 2中,我设法使用远程存储实现无限滚动网格.我基本上采用了一个现有的(完全可操作的)分页网格(带有远程存储,过滤和排序),然后输入适当的配置进行无限滚动:

// Use a PagingGridScroller (this is interchangeable with a PagingToolbar)
verticalScrollerType: 'paginggridscroller',
// do not reset the scrollbar when the view refreshs
invalidateScrollerOnRefresh: false,
// infinite scrolling does not support selection
disableSelection: true,   
Run Code Online (Sandbox Code Playgroud)

它没有在文档中的任何地方说明(请参阅无限滚动部分),但您需要将商店设置为具有buffered: true配置.你不能加载store.load()它需要这样做:

store.prefetch({
    start: 0,
    limit: 200,
    callback: function() {
        store.guaranteeRange(0, 99);
    }
});   
Run Code Online (Sandbox Code Playgroud)

尽管如此,如果我慢慢滚动并因此允许数据预取,不使用任何过滤器并且不使用任何排序,一切都很好.

但是,如果我快速滚动或尝试使用过滤器激活无限滚动网格重新加载或在排序时它们全部分开.错误是options is undefined.

我花了几个小时在代码中进行一些跟踪和谷歌搜索,除了得出结论,没有人实现了带有远程过滤器和远程滚动的无限滚动网格,我发现了以下内容:

过滤正在崩溃,因为这种方法在Ext.data.Store无限卷轴需要来自服务器的更多数据时被无限卷轴调用:

mask: function() {
    this.masked = true;   
    this.fireEvent('beforeload');
},
Run Code Online (Sandbox Code Playgroud)

由于某种原因,此方法在没有参数的情况下触发 …

javascript filtering extjs dom-events extjs4

17
推荐指数
1
解决办法
1万
查看次数

如何在ExtJS组合框中添加空项?

我想添加和清空项目(显示值为空,项目高度保持正常)到Ext.form.ComboBox.我在下面提到了2个链接来配置我的组合框,但它仍然没有显示空项目:

这是我的代码:

this.abcCombo = new Ext.form.ComboBox({
    name : 'abcCombo',
    hiddenName : 'abcCombo-id',
    fieldLabel : "My Combobox",
    width : 250,
    editable : false,
    forceSelection : true,
    mode : 'local',
    triggerAction : 'all',
    valueField : 'id',
    displayField : 'fullName',
    store : new Ext.data.JsonStore({
        fields : ['id', 'fullName']
    }),
    tpl : '<tpl for="."><div class="x-combo-list-item">{fullName}&nbsp;</div></tpl>'
});
Run Code Online (Sandbox Code Playgroud)

组合框存储的数据将在Ajax请求(即数据项中的3个项)之后加载.组合框只有3项(不是我预期的4项).你对我的问题有任何想法吗?!非常感谢!

combobox extjs extjs4 extjs3 extjs-stores

17
推荐指数
2
解决办法
3万
查看次数

在div中渲染Ext.application

我想Ext.application在我们现有的网站模板中运行ExtJS4 .我们有一个div #content,我想将应用程序放入其中进行开发.如何将应用程序呈现到此区域,而不是替换现有的html页面?

Ext.application({
    name: 'HelloExt',
    launch: function() {
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
       //   renderTo: Ext.Element.get('#content')  doesn't work
            items: [
                {
                    title: 'Hello Ext',
                    html : 'Hello! Welcome to Ext JS.'
                }
            ]
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

html css extjs extjs4

17
推荐指数
1
解决办法
8085
查看次数

在Javascript中创建类似字典对象的.net

我想在JavaScript中创建一个对象,它将值存储在键,值对中,我应该能够传递一些键,并且应该能够获得它的值.在.NET世界中,我们可以使用字典类来实现这种实现.我们在JavaScript世界中有任何选择吗?我正在使用ExtJs 4.1,所以如果你知道ExtJS中的任何选项,即使这样也行.

我尝试过类似的东西,但我无法通过钥匙获得价值.

var Widget = function(k, v) {
    this.key = k;
    this.value = v;
};

var widgets = [
    new Widget(35, 312),
    new Widget(52, 32)
];
Run Code Online (Sandbox Code Playgroud)

.net javascript jquery extjs4 lodash

17
推荐指数
1
解决办法
2万
查看次数

ExtJs4 - 存储baseParams配置属性?

在extjs3.x中,我使用stores baseParamsconfig属性来指定用于加载存储的参数.
extjs中不再存在此属性4.我应该怎么做而不是这个?

同样在extjs3中,我能够通过使用代理配置属性来指定存储代理是a GET还是POST方法method.我应该怎么做而不是这个?

我的ExtJs 3代码 - >

   var store = new Ext.data.JsonStore({
        root: 'Data',
        baseParams: {
           StartDate: '',
           EndDate: '''
        },//baseParams
    proxy: new Ext.data.HttpProxy({
        url: 'Time/Timesheet',
        method: 'POST'
    })//proxy
});//new Ext.data.JsonStore
Run Code Online (Sandbox Code Playgroud)

javascript extjs store params extjs4

16
推荐指数
2
解决办法
3万
查看次数

ExtJS 4提供的建议,帮助:网格:单元格编辑:自动编辑功能

我搜索了ExtJS相关的问题并没有找到任何参考,但如果我错过了抱歉提前复制问题.

我想问一下如何制作ExtJS 4网格的一些帮助:单元格编辑:自动编辑功能 - 我的意思是,当我按一个键时我想进入单元格编辑模式(例如,按下"123"突出显示的单元格,用"123"替换文本(如果有的话).进入单元格编辑模式时,可以按ENTER或用鼠标单击.

作为基础我使用Sencha提供的示例:http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/cell-editing.html

任何提示,指针都会很有意义.

提前致谢!:)

其实我确实部分解决了我的问题.找到了一种在按键上使单元格可编辑的方法,将selectOnFocus config参数放入单元格中进行文本选择,现在我需要在单元格中插入第一个char(启动编辑模式).

它可能不是最美丽的解决方案,但它适用于我:)这是完整的代码到现在为止.

var tStore = Ext.create('Ext.data.Store', {
    storeId:'simpsonsStore',
    fields:['name', 'email', 'phone'],
    data:{'items':[
        {"name":"Lisa", "email":"lisa@simpsons.com", "phone":"555-111-1224"},
        {"name":"Bart", "email":"bart@simpsons.com", "phone":"555--222-1234"},
        {"name":"Homer", "email":"home@simpsons.com", "phone":"555-222-1244"},
        {"name":"Marge", "email":"marge@simpsons.com", "phone":"555-222-1254"}
    ]},
    proxy: {
        type: 'memory',
        reader: {
            type: 'json',
            root: 'items'
        }
    }
});

var tCellEdit = Ext.create('Ext.grid.plugin.CellEditing', {
    clicksToEdit: 1
});

var tGrid = Ext.create('Ext.grid.Panel', {
    title: 'Simpsons',
    store: tStore,
    columns: [
        {header: 'Name',  dataIndex: 'name', field: 'textfield'},
        {header: 'Email', dataIndex: 'email', flex:1, …
Run Code Online (Sandbox Code Playgroud)

javascript extjs extjs4

16
推荐指数
1
解决办法
2万
查看次数

mixin vs插件.选择什么?

假设我已经定义了几个新的组件- MyComponent1,MyComponent2......,这延长Ext.Component.

现在我想用相同的功能扩展所有这些小部件 - 我想添加close一个出现在右上角位置的按钮MyComponentX.el.

我该怎么用:mixinplugin?或者是其他东西?
总的来说mixin vs plugin,最佳做法是什么?

plugins extjs mixins extjs4

16
推荐指数
2
解决办法
5763
查看次数