Results 1 to 10 of 10

Thread: Tree populate FormPane

  1. #1
    Sencha User
    Join Date
    Oct 2008
    Location
    france
    Posts
    53

    Default Tree populate FormPane

    I need to populate a formPanel when I click on the node of the treePanel,
    listeners: {
    click: function(n){
    var contactForm =Ext.getCmp('contactForm');
    en_tete_job.load({ params: { 'id': n.attributes.text} });
    }}

    I use this code it's run for reload json but I can not fill up the form.

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Where should the data for the form come from?

  3. #3
    Sencha User
    Join Date
    Oct 2008
    Location
    france
    Posts
    53

    Default

    I use a JsonStore

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Are you using the JsonStore for multiple record or only for a single record?

    If it only holds a single record, then you shouldn't be using a store at all. Instead, you should simply load the form itself (requires a slightly different syntax in the server response).

  5. #5
    Sencha User
    Join Date
    Oct 2008
    Location
    france
    Posts
    53

    Default

    I use JsonStore with multiple record, I have 5 fields in my data to fill up the form
    thanks condor

  6. #6
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    But if the store contains multiple records, how do you know which record to use to load the form?

  7. #7
    Sencha User
    Join Date
    Oct 2008
    Location
    france
    Posts
    53

    Default

    This is my JsonStore :

    var en_tete_job = new Ext.data.JsonStore({
    url: 'data_pagging_jobs.php',
    baseParams:{task: "Load"},
    root: 'results',
    method: 'POST',
    fields:[{name: 'date_job', mapping: 'date_job',renderer:Ext.util.Format.dateRenderer('Y-m-d')},
    {name: 'departement', mapping: 'departement'},
    {name: 'operation', mapping: 'operation'},
    {name: 'production', mapping: 'production'},
    {name: 'intervenant', mapping: 'intervenant'},
    {name: 'indice', mapping: 'indice'}],
    autoLoad: false
    });

    This is load when the node is selected.
    And this is a part of my form
    var contactForm = new Ext.form.FormPanel({
    id:'contactForm',
    title: '',
    region: 'north',
    height: 201,
    labelWidth: 130,
    buttonAlign: 'center',
    items: [
    {
    xtype: 'datefield',
    fieldLabel: 'Label',
    name:'date_job',
    id:'date_job'
    },
    {
    xtype: 'textfield',
    fieldLabel: 'Label',
    name:'departement',
    id:'departement'
    },
    {
    xtype: 'textfield',
    fieldLabel: 'Label',
    name:'operation',
    id:'operation'
    }

    how can I select data from my JsonStore and put in my form
    Thanks condor

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    We don't know.

    If

    Code:
    en_tete_job.load({ params: { 'id': n.attributes.text} });
    really does load multiple Records (and I'm not sure it does), then you must select which one of them to load into the Form.

  9. #9
    Sencha User
    Join Date
    Oct 2008
    Location
    france
    Posts
    53

    Default

    You have right, the code you show is just to pass in the url the id
    to select the right data in the database. I need to display in the form the answer of jsonStore to the form.

    Thanks animal

  10. #10
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    So you only return a single record? In that case you shouldn't be using a store!

    Simply load the form:
    Code:
    formPanel.getForm().load({
      url: 'data_pagging_jobs.php',
      params: {
        task: 'Load',
        id: n.attributes.text
      }
    });
    (Note: this requires a slightly different response from the server)

Similar Threads

  1. Why doesn't tree populate?
    By PCSpectra in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 26 Jan 2010, 2:55 PM
  2. Replies: 8
    Last Post: 16 Apr 2009, 8:47 AM
  3. BaseTreeLoader doesn't populate tree
    By gstasica in forum Ext GWT: Help & Discussion (1.x)
    Replies: 3
    Last Post: 12 Jan 2009, 3:51 PM
  4. Unable to Populate Tree
    By ender07 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 4 Nov 2008, 8:07 AM

Posting Permissions

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