简体   繁体   English

ExtJS:寻找与拖放类似的组件?

[英]ExtJS: Looking for a component almost like drag-drop?

I need a component but couldn't find within Kitchen Sink examples. 我需要一个组件,但在Kitchen Sink示例中找不到。

Is there any component like on this below image? 下图是否有类似的组件?

这个


Briefly; 简短地;

  • On left container there will be several items; 在左侧的容器上将有几件物品; items'll load through web-service. 项目将通过网络服务加载。

  • On middle there will be an add button which transfer selected item on left cointainer to right container. 在中间,将有一个添加按钮,用于将左侧硬币容器中的选定项目转移到右侧容器中。

  • Finally at right container those items will collect and with Save button those items in right container will upload to DB with CRUD process. 最后,将在正确的容器中收集这些项目,并使用“ Save按钮将正确的容器中的那些项目通过CRUD进程上传到DB。

This functionality could be drag-drop as well... 此功能也可以拖放...

Thanks in advance. 提前致谢。

You can implement this functionality using itemselectorfield or itemselector extjs component. 您可以使用itemselectorfielditemselector extjs组件来实现此功能。

In this FIDDLE , I have created a demo using itemselector component. 在这个FIDDLE中 ,我使用itemselector组件创建了一个演示。 Hope this will help/guide you to achieve your requirement. 希望这会帮助/指导您达到要求。

CODE SNIPPET 代码片段

Ext.application({
    name: 'Fiddle',

    launch: function () {

        Ext.onReady(function () {

            Ext.define('Items', {
                extend: 'Ext.data.Store',
                alias: 'store.itemsstore',
                fields: ['value', 'text'],
                data: [{
                    text: 'Item 1',
                    value: 'item1'
                }, {
                    text: 'Item 2',
                    value: 'item3'
                }, {
                    text: 'Item 3',
                    value: 'item3'
                }, {
                    text: 'Item 4',
                    value: 'item4'
                }, {
                    text: 'Item 5',
                    value: 'item5'
                }, {
                    text: 'Item 6',
                    value: 'item6'
                }, {
                    text: 'Item 7',
                    value: 'item7'
                }, {
                    text: 'Item 8',
                    value: 'item8'
                }]
            });

            Ext.create({
                xtype: 'form',
                title: 'Drag and Drop example',

                bodyPadding: 10,
                renderTo: Ext.getBody(),
                items: [{
                    xtype: 'itemselector',
                    anchor: '100%',
                    store: {
                        type: 'itemsstore'
                    },
                    displayField: 'text',
                    valueField: 'value',
                    allowBlank: false,
                    msgTarget: 'side',
                    fromTitle: 'Available',
                    toTitle: 'Selected'
                }]
            });

        });
    }
});

您应该使用MultiSelectItemSelector

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM