Set same value for multiple records/refresh GridPanel

Page 2 of 2 FirstFirst 12
  1. #11
    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:

    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 property
    3. 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).
  2. #12
    That worked. Thanks!
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 11
    Last Post: Oct 11, 2018, 3:34 PM
  2. Replies: 0
    Last Post: Mar 11, 2012, 9:20 AM
  3. Replies: 2
    Last Post: Nov 11, 2011, 3:02 AM
  4. Replies: 3
    Last Post: Jun 29, 2010, 2:54 PM
  5. Issue with inserting multiple records in grid
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 1
    Last Post: Jul 27, 2009, 5:27 PM

Tags for this Thread

Posting Permissions