cdotyone / mochaui

development tree for MochaUI
http://mochaui.org/demo/
Other
290 stars 83 forks source link

MUI.List command problem #74

Closed flmn closed 13 years ago

flmn commented 13 years ago

I create a MUI.List like file Source/Controls/list/index.html, if I add two commands, like:

MUI.create('MUI.List', {
            id: container + 'datatypelist',
            container: container,
            clearContainer: true,
            alternateRows: true,
            content: {url: 'datatypes', paging: {size: 10, totalCount: 200, recordsField: false}},
            columns: [
                {text: 'Name', name: 'typeName', value: 'typeName'},
                {text: 'Created At', name: 'createdAt'}
            ],
            commands: [
                {text: 'Delete', name: 'Delete', image: '{theme}images/cancel.png'},
                {text: 'Edit', name: 'Edit', image: '{theme}images/o-magnifier.png'}
            ],
            onItemCommand: function(item, self, cmd) {
                if (cmd.name == 'Edit') {
                    // do some thing
                }
            }
        });

When I click Delete command, in onItemCommand function, I also get the cmd.name to 'Edit', not 'Delete' as expect. I think this function always set cmd to last command in commands list.

cdotyone commented 13 years ago

this has been fixed, just pull new version or check last commit

flmn commented 13 years ago

Thanks very much.