Results 1 to 4 of 4

Thread: Panel Binding - Complex Data

  1. #1

    Default Answered: Panel Binding - Complex Data

    I want to use Senchas binding with MVC, where I set the name of a UI component to the name of a column on a model, then use the setRecord function on the panel to have the framework automatically set the values on the form.

    This works when the binding is for data in the root of the model, but I need it to work in the following scenario:

    Lets say I have a model like this..

    Code:
     
    Ext.define("MyApp.model.Request", {
                    extend: "Ext.data.Model",
                    config: {
                    fields: [
                        { name: "CreateDate", type: "date" },
                         { name: "Status", type: "auto" }
                        { name: "Property", type: "auto" }
                    ],
                   
                    validations: [
                    ]
                    }        
    });
    And I have json data like this

    Code:
    {
                    "Property": {
                            "PropertyId": 23094,
                            "Name": "Belk 299 Martin Towne Plaza",
                    },
                    "Status": {
                             "Id": 13,
                             "Name": "In Progress",
                    },
                    "CreateDate": "2015-07-03T03:16:52+00:00"
    }
    And the textfield component configured like

    Code:
     
    {
                    xtype: 'textfield',
                    clearIcon: false,
                    name: 'Status,
                    id: 'requestdetail-requeststatus',
                    labelWidth: '',
                    label: 'WO Status',
                    labelAlign: 'top'
    },
    I need to know how to bind to the Name of the Status. If I run the code above, I get .. [object Object] in the field.

  2. Hi--

    You could create a mapping on your "Status" field:

    http://docs.sencha.com/touch/2.4/2.4...ld-cfg-mapping

    This will allow you to "map" the "Status" field to the "Status.Name" data.

    Thanks!
    Joel

  3. #2
    Sencha User
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    You could create a mapping on your "Status" field:

    http://docs.sencha.com/touch/2.4/2.4...ld-cfg-mapping

    This will allow you to "map" the "Status" field to the "Status.Name" data.

    Thanks!
    Joel

  4. #3

    Default

    Thanks Joel

  5. #4
    Sencha User
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Quote Originally Posted by eclipsed4uto0 View Post
    Thanks Joel
    Sure thing, glad it helped!

    Thanks
    Joel

Similar Threads

  1. Complex Data Binding
    By lsamples in forum Ext 5: Q&A
    Replies: 7
    Last Post: 6 Mar 2015, 12:37 PM
  2. Load complex data in form panel
    By Roman_S in forum Ext: Q&A
    Replies: 2
    Last Post: 8 Mar 2013, 11:34 AM
  3. complex binding to form and data relation
    By ran.davidovitz in forum Ext: Discussion
    Replies: 1
    Last Post: 3 Jul 2011, 11:28 PM
  4. Saki Examples: Complex Data Binding with JSON
    By Tumac in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 5 Jan 2010, 11:20 AM
  5. Complex Data Binding Example by Saki
    By jsakalos in forum Community Discussion
    Replies: 0
    Last Post: 12 Feb 2009, 1:42 PM

Posting Permissions

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