How to handle events

  1. #1

    How to handle events

    Hi:

    I am a newbie to ext.net, however, I have experience with ExtJs and GXT.

    What is the best way to handle events that interact with the extjs controls/data on a page? Do I modify the control through JavaScript or through C# code executed via Ajax calls (DirectMethod etc.). I guess that if I need to go the database I need to do it in C#, or perhaps a combination of C# & JavaScript.

    Example:

    I click on a node in a TreePanel and I need to add a tab to a TabPanel. Do I handle this event entirely in the client JavaScript 100%? Does it make sense to have a DirectMethod call, and add the tab in C#? I checked out the examples project that comes with ext.net and it's done in JavaScript.

    Coming from the ExtJs and GXT worlds where the demarcation is clearer, I have trouble picturing in my head how the client state flows from the client side to the server side during DirectMethod calls or posts and how much the server objects reflect the client state.

    Another example: Let's say the user adds a new row in a GridPanel on the client side (the row gets added to a Store). If I execute a DirectMethod, is the Ext.net.GridPanel C# object going to contain that new row?

    Is there any documentation that you can point me to that describes how this mapping between the client state and server works during ajax and post calls? I guess I am going to spend some time reading the source code as well but it would be nice to see some documentation.

    Thanks
    Last edited by costab; Apr 26, 2011 at 4:52 AM.
  2. #2
    Hi,

    I click on a node in a TreePanel and I need to add a tab to a TabPanel. Do I handle this event entirely in the client JavaScript 100%? Does it make sense to have a DirectMethod call, and add the tab in C#? I checked out the examples project that comes with ext.net and it's done in JavaScript.
    Please use direct event and add tab via C#. Please see
    https://examples1.ext.net/#/XRender/Basic/Add_Items/

    I recommend to use code behind if server side actions are required only (in other cases it is better to create tab via javascript (of course, if ExtJS javascript code is not problem for you) )

    Let's say the user adds a new row in a GridPanel on the client side (the row gets added to a Store). If I execute a DirectMethod, is the Ext.net.GridPanel C# object going to contain that new row?
    Store doesn't submit any data, you have to manually save/submit data
    Please see the following sample (and other samples from that branch)
    https://examples1.ext.net/#/GridPane...s/StoreEvents/
    https://examples1.ext.net/#/GridPane...mit_Two_Grids/
  3. #3
    Thanks, Vladimir.

Similar Threads

  1. Replies: 0
    Last Post: Jul 27, 2012, 7:54 PM
  2. [CLOSED] How to properly handle exceptions in Direct Events?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 07, 2012, 5:00 PM
  3. Replies: 15
    Last Post: Feb 03, 2011, 1:27 PM
  4. Replies: 4
    Last Post: Dec 28, 2009, 12:07 PM
  5. Handle exception and static method
    By Yannis in forum 1.x Help
    Replies: 4
    Last Post: Dec 18, 2009, 11:45 AM

Posting Permissions