0

当我单击删除按钮时,我面临的问题是我无法从列表中删除任何行或多行。这是我的代码:

    {
        xtype: 'list',
        store: "Plays",
        itemId:"playsList",
        mode: 'MULTI',
        loadingText: "Loading PlaysList...",
        emptyText: '<div class="notes-list-empty-text">No PlayList found.</div>',
        itemTpl: '<div class="list"><div class="list-item-title">{title}</div><div class="list-item-narrative">{duration}</div><div class="list-item-hide">{hidden}</div></div>',      
        itemSelector: 'div.list',

   },
    {
                    xtype: "button",
                    iconCls: "trash",
                    iconMask: true,
                    itemId: "deleteButton"
            },

   onDeleteButtonTap: function () {
        //console.log("deleteNoteCommand");//How to get value of recored from playlist

    this.fireEvent("deleteNoteCommand", this);
},

现在我选择任何行并单击删除按钮然后我如何获取所选项目或行的值并通过点击按钮执行一些操作。像这里我正在删除选定的行控制器

  Ext.define("PlayListApp.controller.Plays", {
      extend: "Ext.app.Controller",
    config: {
         refs: {
        // We're going to lookup our views by xtype.
        notesListView: "playslistview",
         notesList: "#playsList",
  },
  },
   onDeleteNoteCommand: function () {
      console.log("onDeleteNoteCommand");

    var noteEditor = this.getNotesList();
    console.log(noteEditor);
    }
4

1 回答 1

1

当您在选择列表记录后点击按钮时,您可以使用以下代码获取所选列表记录

  var record= this.getNotesList().getSelection()[0];

此代码为您提供选择的记录,之后您可以使用以下代码从存储中删除记录

this.getNotesList().getStore().remove(record);//bracket in here too....
于 2012-06-23T11:56:16.207 回答