1. #1
    Sencha Premium Member andrei.neculau's Avatar
    Join Date
    Jul 2007
    Location
    Sweden
    Posts
    197
    Vote Rating
    0
    andrei.neculau is on a distinguished road

      0  

    Default [1.1.1] JsonReader: mapping to undefined element

    [1.1.1] JsonReader: mapping to undefined element


    http://extjs.com/forum/showthread.php?p=45310#post45310

    This issue was touched on a couple of months ago, but never made it to 1.1.1 . Though it was suggested in the thread to submit a bug report, I couldn't find one in my search.

    What happens is this: if you have a record field mapped to another field (deep down, not on the second level - e.g. mapping:"country.city.street" with country.city undefined), which doesn't exist in the current record's data.. then the whole reading process stops, and thus data loading stops, without any data being loaded.

    This shouldn't happen. Instead, the field's value should get the defaultValue.

    Animal - already provided a solution, but since this seems to be not an "personal/individual enhancement" it seems logical not to have it as a "hack" (overriding general release functions).

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    According to the definition of bug in http://extjs.com/forum/showthread.php?t=8887:
    What's a bug?
    A software bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from behaving as intended (adapted from this Wikipedia entry). The intended behaviour of methods from all Ext classes can be found in the Ext Documentation Center.
    this is not a bug. The intended behavior is to process JSON containing all fields received from the server and that is what JsonReader does flawlessly.

    I agree that patch Animal proposed adds functionality, features to JsonReader and makes it more "bullet-proof". The fact that Jack hasn't added it to the trunk was his decision. Maybe he sacrificed functionality for stability as adding new features can introduce new bugs.

    Anyway, I'm notifying Jack on this matter.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  3. #3
    Sencha Premium Member andrei.neculau's Avatar
    Join Date
    Jul 2007
    Location
    Sweden
    Posts
    197
    Vote Rating
    0
    andrei.neculau is on a distinguished road

      0  

    Default


    OK. At least, maybe clarify in the Docs that if not all fields referenced by the mapping attribute then JsonReader fails to load any data at all.

    Thanks and sorry if this was already discussed and ignored - I didn't see any reference to this in the Bugs section.

  4. #4
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    123
    Vote Rating
    0
    BuckBazooka is on a distinguished road

      0  

    Default


    I don't get it.
    Here is the description of defaultValue for record definition.
    Code:
    defaultValue : Mixed
    The default value used when a Record is being created by a Reader when the item referenced by the mapping does not exist in the data object (i.e. undefined). (defaults to "")
    Code:
    Ext.data.Record.create([
      {name: 'firstName'},
      {name: 'lastName'},
      {name: 'countryName', mapping: 'country.name', defaultValue:"N/A"},
      {name: 'contryState', mapping: 'country.state', defaultValue:"N/A"}
    ])
    When country is not defined I would expect "N/A" to be displayed.
    So maybe there is no bug in the JSONReader... but defaultValue definitely does not work!

  5. #5
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Are you sure that you're going to use Ext 1.1.1? The current version is Ext 3.0.2 and Ext 1.x is not supported anymore.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  6. #6
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    123
    Vote Rating
    0
    BuckBazooka is on a distinguished road

      0  

    Default


    Thanks jsakalos for your answer. Of course I am not using Ext 1.x, but I'm now stock on V2.3.0. Want to migrate but I had encountered some serious performance issues when I had moved to 3.0.0.

    I will be delighted to try the newest version. Thanks to all of you for this FANTASTIC tool.

  7. #7
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,561
    Vote Rating
    384
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    I asked because this thread is 2 years old so any information in it can be obsolete.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


Thread Participants: 2