外部JS。如何加载缓冲滚动示例中的所有行?

发布于 2024-12-11 09:21:18 字数 307 浏览 0 评论 0原文

在这个例子中: http://dev.sencha.com/deploy /ext-4.0.2a/examples/grid/buffer-grid.html

我想添加一个标题为“全部读取”的按钮,单击该按钮时,应加载所有行,这样就不再需要缓冲了。

当用户想要对所有内容有更多控制而不必在特殊情况下等待缓冲区完成时,这非常有用。

谢谢,非常感谢任何帮助

In this example:
http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/buffer-grid.html

I'd like to add a button titled "Read all", and when it is clicked, all rows should be loaded so no more buffering.

This is useful when the user wants to have more control over all the contents without having to wait for the buffer to finish in special cases.

Thanks, any help is appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

<逆流佳人身旁 2024-12-18 09:21:18

使用两个具有共同型号的商店。

第一个是当前的(带有缓冲、分页等)。第二个是普通存储,没有缓冲、分页等。当您单击“全部读取”时,只需将所有记录加载到第二个存储中,并用新数据更新第一个存储。

下面是一个示例:

Ext.create ('Ext.grid.Panel', {
    renderTo: Ext.getBody () ,
    width: 300 ,
    height: 300 ,
    store: bufferingStore ,

    columns: [ ... ] ,

    tbar: {
        items: [{
            xtype: 'button' ,
            text: 'Read all' ,
            handler: function (btn) {
                // Here's the call to retrieve all records
                // Also you can do it with 'autoLoad: true' param
                normalStore.load ();

                // Then, flush the bufferingStore, currently use by the grid
                bufferingStore.removeAll ();

                // Populate bufferingStore with normalStore
                normalStore.each (function (record) {
                    bufferingStore.add (record);
                });
            }
        }]
    }
});

NormalStore 和 bufferingStore 具有相同的模型,但NormalStore 将具有不同的源来检索每条记录。

Use two store with common model.

The first one is the current one (with buffering, paging, etc.). The second one is a normal store, without buffering, paging, etc. When you click on 'Read all' just load every records into the second store and update the first one with the new data.

Here's an example:

Ext.create ('Ext.grid.Panel', {
    renderTo: Ext.getBody () ,
    width: 300 ,
    height: 300 ,
    store: bufferingStore ,

    columns: [ ... ] ,

    tbar: {
        items: [{
            xtype: 'button' ,
            text: 'Read all' ,
            handler: function (btn) {
                // Here's the call to retrieve all records
                // Also you can do it with 'autoLoad: true' param
                normalStore.load ();

                // Then, flush the bufferingStore, currently use by the grid
                bufferingStore.removeAll ();

                // Populate bufferingStore with normalStore
                normalStore.each (function (record) {
                    bufferingStore.add (record);
                });
            }
        }]
    }
});

normalStore and bufferingStore have the same model but normalStore will have a different source to retrieve each record.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文