Aug 10, 2020, 9:54 PM
Hello Dennis!
You were pretty close in the test case you provided!
You can change it to the following and get what you probably expect:
1.
2. JavaScript arrays do not implement
3.
Hope this helps!
p.s.: as a suggestion, experiment replacing your
You were pretty close in the test case you provided!
You can change it to the following and get what you probably expect:
var onSelectionChange = function (grid, selection, eOpts) {
try {
var message = '??';
if (selection.length < 1) {
message = 'No selection';
}
else {
message = 'Selected entries: ' + selection.length;
}
Ext.Msg.alert(message);
}
catch (err) {
Ext.Msg.alert('Error: ' + err);
}
};
There were three issues with your test case's code:1.
selection
will never be false-ish as it is either an empty array or an array with the selection entries.2. JavaScript arrays do not implement
getCount()
, I'm not sure where you got this from. Should use Array's Length property3.
Ext.Msg.alert()
takes a string as its title argument. Providing an object results in what you got: an empty title -- unless that object hat the text
property. Which is not the case of a caught javascript exception, it seems. Concatenating the exception object with a string is enough to implicitly cast it, otherwise call its .toString() method.Hope this helps!
p.s.: as a suggestion, experiment replacing your
Ext.Msg.alert()
calls to Ext.toast()
. It is good for feedback without having to click any confirmation (thus losing components focus, etc).