[CLOSED] Conditionally Render Ext.Net object only if it does not already exist.

  1. #1

    [CLOSED] Conditionally Render Ext.Net object only if it does not already exist.

    Hello,
    I am using Ext.Net V4.1.0.0 and c# in Net Framework 4.6.1.
    I have an MVC View which have several tabs that display an identical control with different data. I also have an Ext.Net.Window which can serve all of the tabs. Each tab is independent of the others which may or may not be there depending on the configuration. I want to add the Ext.Net.Window in code behind on each instance of a tab, but only have the first instance render when the page is rendered. Is there any way to only add the Ext.Net.Window to the rendered view once and have any subsequent attempt to add the Ext.Net.Window with the same ID ignored?
    Thanks.
    Last edited by fabricio.murta; Jan 18, 2017 at 6:56 PM.
  2. #2
    Hello @edip!

    Well, for that you'd have to transmit back all the IDs from client to server when doing the request. Code behind calls don't really know what's going on client-side unless told so. You may, for example, encapsulate in an array of IDs -- sent as ExtraParameters() -- so you can check against this list in code behind.

    You can send just the list of IDs of panels inside the target TabPanel, but take care not to have the possible tabs conflict with IDs throughout the page.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    A more reliable way -- if acceptable/possible -- would be to do the test client-side. Bind a listener before the action proxy/direct call, so that if a request would bring an already existing window/tab, then it does not move ahead to the direct call.
    Last edited by fabricio.murta; Jan 16, 2017 at 5:10 PM.
  4. #4
    Thanks Fabricio, Are there any existing examples of this on your site?
  5. #5
    Hello @edip!

    Here's an example with ExtraParams: Grid Panel - Batch update.

    There are several other examples with this, you can just search for 'ExtraParams' in Examples Explrer's sources.

    The example shows an even better (and appropriate) way to block the direct event from running depending on client-side state.
    Check line 406, bottom of the code, in the 'sync' button direct event. You see a Before= property to the Click direct event. Whenever code inside returns false, it does not trigger the direct event itself.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  6. #6
    Thanks Fabricio.
  7. #7
    Hello @edip!

    Glad it was of help, are we done here, may I mark the thread as closed?
    Fabrício Murta
    Developer & Support Expert
  8. #8
    Yes, please close this thread.
  9. #9
    Thanks for the feedback! Closed! :)
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Conditionally changing color of Text in row of a Grid
    By barnali in forum 3.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 24, 2015, 12:48 PM
  2. [CLOSED] Conditionally disable editing on ComponentColumn() Editor
    By barnali in forum 3.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 24, 2015, 12:47 PM
  3. [CLOSED] GridPanel Row Background Color Change Conditionally
    By ebeker in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 14, 2014, 4:45 PM
  4. Replies: 0
    Last Post: Oct 21, 2011, 3:04 AM
  5. [CLOSED] [1.0] Render Panel to a non-ext object
    By Patrick in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 10, 2010, 12:13 PM

Tags for this Thread

Posting Permissions