SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ExtJS: Fill a field form with a grid

    Hi, people
    I'm starting with javascript and I have a doubt.
    I already have a grid with data and a form with 5 fields.
    One of these fields of the form I want to fill with data of the grid.

    This is what I have:
    Code:
    sm: new Ext.grid.RowSelectionModel({
    				  singleSelect: true,
    				  listeners: {
    				   rowselect: function(sm, row, rec) {
    				    form.getForm().loadRecord(rec);
    				   }
    				  }
    				 })
    But this way the entire form is filled with the data of the grid.
    What I want is that when the user click on the row, only the first column of that row is sent to the specific field of the form.
    Does anyone know how to do this?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by lpfx View Post
    I already have a grid with data and a form with 5 fields.
    It looks like you're using some kind of code library for this. Can you share with us which code library you are using, so that someone who knows about that code library can help?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    It looks like you're using some kind of code library for this. Can you share with us which code library you are using, so that someone who knows about that code library can help?
    ExtJS

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by lpfx View Post
    ExtJS
    I have modified the thread summary, so that if anyone knows about ExtJS you will be more likely to receive some help from them.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it!

    var fieldForm = Ext.getCmp('idFieldForm');
    fieldForm.setValue(rec.get(''fieldNameOnStore'));


Bookmarks

Posting Permissions

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