[CLOSED] ${org substring is expanded to Ext.select("org... in MVC app

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] ${org substring is expanded to Ext.select("org... in MVC app

    Hello:

    This is an interesting one for sure. I am testing it in Ext.Net MVC 2.5.3.

    To reproduce:

    1. Open the Ext.Net.2.5.3\Ext.Net.Examples.MVC\Areas\Data_Basi c\Models\ModelSerializerModel.cs file and add ${org to the Company value as it is represented here (I added it to the second item):


            public static List<object> Data
            {
                get
                {
                    List<object> goods = new List<object>()
                    {
                        new
                            {
                                Id = 1,
                                Price = 71.72,
                                Company = "3m Co",
                                Date = new DateTime(2013, 9, 1),
                                Size = "large",
                                Visible = true
                            },
                        new
                            {
                                Id = 2,
                                Price = 29.01,
                                Company = "Aloca Inc ${org",
                                Date = new DateTime(2013, 08, 01),
                                Size = "medium",
                                Visible = false
                            },
    2. Run the MVC examples project and go to : Data -> Basic -> ModelSerializer.
    3. Click on the Get a list of companies with sizes.
    4. A message box is displayed - see the screenshot:



    How can I make this right and stop the conversion of the ${org substring?

    Thanks
    Attached Thumbnails Click image for larger version. 

Name:	export_message.PNG 
Views:	12 
Size:	12.1 KB 
ID:	20232  
    Last edited by Daniil; Feb 05, 2015 at 7:05 PM. Reason: [CLOSED]
  2. #2
    Hello @bogc,

    Is it an option for you to use &dollar; in place of $?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    The problem is that $ can be saved in any text field. It can be anywhere, basically. And I cannot replace $ with &dollar; in all string values. I cannot sprinkle my code everywhere with replace statements to replace $. It has to be fixed in a different way, in a single place, without me having to touch the values converted to json that are returned to the client
    Last edited by bogc; Feb 04, 2015 at 5:27 AM.
  4. #4
    Hello everybody,

    Please see this thread and post:
    http://forums.ext.net/showthread.php...ll=1#post92632

    You can use
    TokenUtils.Settings.SelectParsingDisable = true;
    or
    TokenUtils.Settings.DisableDuringDirectEvent = true;
  5. #5
    If I use one of these settings, what is the impact? Could you please point to a scenario where using disableDuringDirextEvent=true would break existing code?

    I don't have a good appreciation of the patterns that might be broken after using the setting.

    Thanks!
  6. #6
    If you use either of #{}, ${} or ={}, then something might be broken.

    If you don't use, then nothing should be broken.
  7. #7
    I qualify what I am sending back as "data". For instance, in the example on this thread, the goods collection returns "data". I don't think what qualifies as "data" should be scanned (I understand that it may be impossible to know from the framework's point of view what's "data" and what's not).

    I still have to wrap my head around this. I have these types of action results:

    - Views - these might use #{....} in JavaScript handlers - I definitely don't want to affect these.
    - StoreResult - I think these should not be scanned
    - DirectResult - Here is where I had the problem - the result was a list with a few DTOs.
    - FormResult - usually these contain error messages or some data.

    I've seen somewhere in the examples instances where execute something on the server and it gets translated into JavaScript code on the client side. I would think these would break but I might be wrong.

    I am going to use:

    TokenUtils.Settings.DisableDuringDirectEvent = true;
    and test the app to see if there is anything broken.

    It might be a good idea to be able to mark certain objects as non-scannable, i.e. their translation to json should not be scanned.

    Thanks
    Last edited by bogc; Feb 04, 2015 at 5:00 PM.
  8. #8
    Hi:

    I tried:

     TokenUtils.Settings.DisableDuringDirectEvent = true;
    but it doesn't seem to have an effect on a controller method that returns a DirectResult.

    The code looks roughly like this:

       public DirectResult GetSomeData(int id)
        {
          DirectResult result = new DirectResult();
    ...      
          result.Result = new List<object>
                            {
                              // the data for the stores has to be placed in an array
                              new List<object> {dto1},
                              new List<object> {dto2},
                              dto3,
                            };
    
    
          return result;
        }

    The setting works in the Ext.Net MVC sample though. Could it be because I am using 2.5.2? I cannot upgrade at this time to 2.5.3.

    Should the setting affect these actions as well?

    Thanks
    Last edited by bogc; Feb 04, 2015 at 6:54 PM.
  9. #9
    Using:

    TokenUtils.Settings.SelectParsingDisable = true;
    fixes the issue.

    Would this affect situations where I have something like this:

     Handler = "#{someComponent}.someProperty = 100"

    Thanks

    Update: I does not affect code like this:

          
    <ext:Button runat="server" Text="Show/Hide Field Container">
     <Listeners>
       <Click Handler="#{fieldContainer}.setVisible(!#{fieldContainer}.isVisible()); #{tabPanel}.setActiveTab(#{firstPanel}); #{textArea}.setValue('Line1\r\nLine2\r\nLine3\r\nLine4\r\nLine5\r\nLine6\r\nLine7\r\n'); "></Click>
      </Listeners>
    </ext:Button>
    #{fieldContainer} gets translated properly.
    Last edited by bogc; Feb 04, 2015 at 6:55 PM.
  10. #10
    Sorry for insisting on this, if you were to set SelectParsingDisable = true in your examples projects (webforms and MVC) could you indicate a page that would be broken?

    Thank you
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] "Select All" option in MultiCombo
    By pj_martins in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 31, 2013, 9:13 PM
  2. [CLOSED] TreePanel - cannot append "after" expanded last node
    By jwf in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 24, 2013, 4:08 AM
  3. Replies: 4
    Last Post: Jul 30, 2013, 5:29 PM
  4. [Razor] How to use OnEvent on in "Select"
    By delta in forum 2.x Help
    Replies: 2
    Last Post: Oct 22, 2012, 9:56 AM
  5. [CLOSED] MultiSelect "select all" from client side
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Sep 20, 2011, 12:04 PM

Posting Permissions