Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

extjs4 - show different item on selectionchange on a grid

i have a grid and a form, i need to show different items on the form each time we select a row on that grid

i ve been looking on how to do this, and found

    Ext.getCmp('myform').hide() // or  .show()

and

    listeners: { selectionchange: function () {...}

now i dont know which row is selected so i can specify which item to show

thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You get the selected rows as second parameter in the selectionchange event handler:

listeners: {
    selectionchange: function (view, selections, options) {
        console.log(view, selections, options);
    }
}

So the first selected row is the first element in the selections array:

record = selections[0]

This is described in the Ext JS 4 API documentation for the selectionchange event.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...