Success! Looks like we've fixed this one. According to our records the fix was applied for DSGNR-1524 in a recent build.
  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    117
    Vote Rating
    11
    Sottilde will become famous soon enough

      0  

    Default Convert functions on model fields broken

    Convert functions on model fields broken


    Two issues here:

    The major one:

    Adding a 'convert' function does not automatically add the parameters (value, record), nor is there any way to add them.

    So code like this is generated:

    Code:
    name: "date_relative"    , type: "string"
        , convert : function(){
              return Date.relative(record.get('date'))
          }
    This triggers an error because 'record' is not being passed.

    The minor one:

    Including a return function in your convert function triggers a "Return not in function" error.

    Basic functions, as well as convert functions, all appear to have this issue.

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    117
    Vote Rating
    11
    Sottilde will become famous soon enough

      0  

    Default


    They are also strange to edit.

    I had to create three convert functions on three fields in a row. The first was fine. The second, after clicking the +, already contained the code of the first. I deleted it and put in new code. The third had the same behavior as the second, so I also deleted the code and put in new code.

    Upon a save, the code in the editor changes back to the code of the first convert function. Double-clicking the highlighted convert function loads the correct function.

    This particular bug seems to be a UI annoyance only.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    117
    Vote Rating
    11
    Sottilde will become famous soon enough

      0  

    Default


    Quote Originally Posted by Sottilde View Post
    This particular bug seems to be a UI annoyance only.
    It's worse than I thought - my second and third convert functions are not being written to the Generated Class at all! They remain accessible in Designer and in the metadata but they do not make it into the code.

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Quote Originally Posted by Sottilde View Post
    It's worse than I thought - my second and third convert functions are not being written to the Generated Class at all! They remain accessible in Designer and in the metadata but they do not make it into the code.
    Confirmed; thanks for the bug report.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    This will be fixed in the next release > 309.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  6. #6
    Sencha User
    Join Date
    Feb 2012
    Posts
    117
    Vote Rating
    11
    Sottilde will become famous soon enough

      0  

    Default


    Quote Originally Posted by aconran View Post
    This will be fixed in the next release > 309.
    Is it possible to get this build? This bug is severely holding us up.

  7. #7
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953
    Vote Rating
    65
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    Planning another update for tomorrow
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  8. #8
    Sencha User
    Join Date
    Feb 2012
    Posts
    117
    Vote Rating
    11
    Sottilde will become famous soon enough

      0  

    Default


    The fix in 311 works great, thank you, although there are some oddities when removing existing convert functions, to switch over to the new type.

    If a user had previously defined a 'convert' function in a field, and clicks the + next to convert (which is in custom properties, because it was previously overridden), the new 'convert' function is still broken as per the original post. There is no value or record being passed in. In addition, a red flag is placed next to the convert function that says "This function is overriding a config set by you".

    Deleting the 'convert' custom property from the field leads you up the creek without a paddle as you are unable to define another convert value.

    Clearing the 'convert' custom property from the field does the same as, while it will clear the "This function is overriding..." warning, it still will not pass (v, rec) into the function.

    The only fix I have found to make this work properly is to delete the 'convert' property by right clicking it, then duplicate the field and delete the original. This makes 'convert' show up properly under "Ext.data.Field" and not under (Custom Properties).

    I don't know if this is a priority for you as it will only affect users upgrading from older builds.


    Here is one small bug that is still present (and effects lots of function definitions):

    Using the 'return' keyword triggers the error "Return not in function". A minor annoyance.



    Thanks again for the fix, guys.

  9. #9
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Thanks Scott, we are aware of all the above.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 2