[CLOSED] SelectAll items in a control, without triggering any event handlers

  1. #1

    [CLOSED] SelectAll items in a control, without triggering any event handlers

    Hi Ext.NET,

    Am trying to select all items in a multi-select combo box, from certain times in serverside processing. But do not want this to trigger any of the control's normal event handlers because it will cause unnecessary postbacks.

    There is this article about doing something like this for the "change" condition of a control
    https://forums.ext.net/showthread.ph...e-Change-event

    But I wish to do this for SelectAll() of an Ext.NET MultiCombo control.
    Cannot find a "raw" version of SelectAll. But I do see it has the raw version of SetValue (which doesn't fire any events).

    SetValue takes an Object param. Can I leverage this to select all of the control's items? Or is there another better way?

    Thanks,
    Last edited by fabricio.murta; Oct 19, 2018 at 4:44 PM.
  2. #2
    Ok, i found that this pattern of suspending events prior to invoking SelectAll, then resuming events afterwards seems to work.

    this.SuspendEvents();
    this.SelectAll(); // serve up this FP multiselect combobox with all items selected, but don't trigger any event handlers
    this.ResumeEvents();

    Let me know if there's a better way to do this, or any special considerations to watch out for with this.
    Otherwise, please consider this case closed. thanks
  3. #3
    Hello @Caleb!

    Thanks for your question, and also for showing an approach that worked for you!

    Actually, the first thing I thought as I was reading the first message was, if all you wanted was not having events fire during that, then suspendEvents() would be the way to go. It would only get more complicated if you wanted local events (listeners, client-side) to still trigger but still skip the server-side triggering events (direct events). But that does not seem to be the case, so I believe your approach is the best you could take.

    I'm assuming the case is solved. Let us know otherwise.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Sep 30, 2015, 5:52 AM
  2. [CLOSED] Server Control, Bin Items Direct Event Submission
    By rcombis in forum 3.x Legacy Premium Help
    Replies: 15
    Last Post: Feb 19, 2015, 3:11 PM
  3. [CLOSED] Event handler before direct event handlers
    By matejgolob in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 08, 2012, 2:31 PM
  4. Replies: 2
    Last Post: Aug 24, 2011, 3:38 AM
  5. Button's onclick event is not triggering -
    By latif in forum 1.x Help
    Replies: 1
    Last Post: Nov 25, 2009, 12:25 PM

Posting Permissions