Results 1 to 6 of 6

Thread: loading one record from table into a form with php/json

  1. #1
    Ext User
    Join Date
    Feb 2010
    Location
    Antwerp, Belgium
    Posts
    33

    Default loading one record from table into a form with php/json

    Hai,

    I'm trying to load one record from a table into a form with php/json but I'm not succeeding.
    Can anyone point me in the right direction please.

    I can load one paricular record in the form if I give the ID harcoded, but I want to make this dynamic

    Thanks,
    Kurt

  2. #2
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244

    Default

    In hope that I understand what you're trying to do:

    Ext.form.BasicForm contains a loadRecord(record) method, which will let you load a desired record from a store directly into the owning Ext.form.FormPanel.

    Code:
    var selectedRecord = someGrid.selModel.getSelected();
    someForm.getForm().loadRecord(selectedRecord);
    Any form field with a name attribute that matches a record field will be auto-populated from the record.

    If I've misunderstood your problem, please reply accordingly.

    Thx.

  3. #3

    Default

    Now imagine you have an XHTML Response Object...Just decode the responseText and pass the result to BasicForm.setValues?

    Code:
    someForm.getForm().setValues({
      x: 12,
      y: '123',
      z: 'foobar'
    });
    Wes

  4. #4
    Ext User
    Join Date
    Feb 2010
    Location
    Antwerp, Belgium
    Posts
    33

    Default

    Hai Screamy,

    Actualy my problem is the datasore itself
    I want to load my datastore with the desired record

    I'm trying to do this with the Ext.data.JsonReader

    but so far no luck

  5. #5
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244

    Default

    The Ext.data.Store documentation has the solution you're looking for, I think:

    Records are cached and made available through accessor functions. An example of adding a record to the store:
    var defaultData = {
    fullname: 'Full Name',
    first: 'First Name'
    };
    var recId = 100; // provide unique id for the record
    var r = new myStore.recordType(defaultData, ++recId); // create new record
    myStore.insert(0, r); // insert a new record into the store (also see add)
    Is this what you're after?

  6. #6
    Ext User
    Join Date
    Feb 2010
    Location
    Antwerp, Belgium
    Posts
    33

    Default

    Hai Screamy,

    Yes that was it, thanks for your help en info.

    Thanks,
    Kurt

Similar Threads

  1. Loading Data into Itemselector using json php
    By murkrishna in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 10 Oct 2010, 4:51 PM
  2. Way to get record count of returned JSON result set before loading?
    By dbassett74 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 29 Jun 2010, 4:40 PM
  3. GridPanel: Shows Only one record[last record form JSON data]
    By rehanazher in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 6 Aug 2009, 7:49 AM
  4. Replies: 0
    Last Post: 14 Nov 2007, 5:44 AM
  5. Update table with PHP/JSON
    By hallikpapa in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 4 Oct 2007, 3:47 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
  •