Results 1 to 4 of 4

Thread: Model not mapped correctly to wire when saving to remote resource

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Sep 2011

    Default Model not mapped correctly to wire when saving to remote resource

    Using Sencha Touch's data classes, I have set up a Model and a Store. I have retrieved a collection into the store from a REST service. Next thing I want to do is sync changes back to the service, but the Sencha Touch Writer class and Field class don't seem to support this very well. For example, given the following model:

    Ext.regModel('News', {
        fields: [
            {name: 'id', type: 'int'},
            {name: 'newsId',  mapping: 'iid', type: 'string'},
            {name: 'source', mapping: 'source', type:'string'},
            {name: 'title', mapping: 'stitle', type: 'string'},
            {name: 'dateModified', mapping: 'tmodified', type: 'date', convert: toDateFromJSON}
    When I sync the store to the service, I get something like this on the wire (using json writer):

    {"d.results": [
        "title":"People will do as they are told by someone who outranks them, but...",
        "dateModified": "2010-09-28T12:28:38.323Z"
    The service doesn't know anything about "newsId", "source", etc.; so it will fail to accept the request. Notice when I defined my model I mapped the service field names to model field names (e.g. "iid" gets mapped to "newsId").

    So I went looking for a way to tell the writer to use the mapped names. Nothing. And I went looking for a way to indicate which fields on my model should be excluded from being persisted. Nothing.

    BUT... Interestingly, ExtJS 4's data package does support these concepts. So I know I'm not crazy and someone at Sencha knows these are important. I.e. See ExtJS Writer nameProperty. And see ExtJS Field persist property.

    These seem like pretty hefty pieces of missing functionality from Sencha Touch. I.e. Try to go beyond anything very simple with respect to syncing a store and you're screwed. What are my options?

  2. #2


    Did you find any solution to your problem ? I am facing the same issue.

  3. #3
    Sencha User
    Join Date
    Sep 2011


    Nope. At some point I was going to look at Sencha 2's data layer and see if the support is better.

  4. #4


    is working in ST 2.0.1 do not know if it will in futur versions. Anyway it is not powerfull enough for me but for your usecase it should be sufficient.

    I will be overriding the
    in a new writer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts