sencha touch SortableList 的使用

转: sencha touch 2.3 多了一个  SortableList plugin, 可实现 list item 的拖动交换

Ext.require('Ext.plugin.SortableList');
Ext.create('Ext.List', {
    fullscreen: true,
    // Set the class to the name you passed in for the handleSelector
    itemTpl: '<div class="gripper">{title}</div>',
    data: [
        { title: 'Item 1' },
        { title: 'Item 2' },
        { title: 'Item 3' },
        { title: 'Item 4' }
    ],

    // These are required to fix a bug that exists in the plugin
    infinite: true,
    variableHeights: true,

    plugins: [
        { xclass: 'Ext.plugin.SortableList', handleSelector: '.gripper' }
    ],

    listeners: [
        {
            event: 'dragsort',
            fn: function (listObject, row, to, from) {
                console.log(from + ' ' + to);
            }}
    ]
});

 

  

你可能感兴趣的:(Sencha Touch)