-
7 Jul 2010 10:24 AM #1
Placement of variable for use in combobox url
Placement of variable for use in combobox url
I have a button associated with my grid, that when i press for "NEW LINE" it opens up a new window with an input form (below).
I am passing the keyfield to the pop-up form as a hidden field.
On the form, I have a combobox that I would like to pass the keyfield to the store so the store only returns records associated with that keyfield in the dropdown.
I have tried placing this var can=Ext.getCmp('container').getValue(); in many places and get the consistent result
Ext.getCmp('container').getValue() is undefined
I assume this is because it is trying to retrieve this value before the pop-form is rendered. Should it be a listener on the combo that onClick gets the value?
Code:Ext.ns("STScls.form"); STScls.form.TallyDetailForm = Ext.extend(STScls.form.FormPanelBaseCls, { border : true, autoScroll : true, bodyStyle : 'background-color: #E8EDEA; padding: 10px', layout : 'form', defaultType : 'textfield', initComponent : function(container) { Ext.applyIf(this, { items : [ this.buildFormFields() ] }); STScls.form.TallyDetailForm.superclass.initComponent.call(this); this.addEvents({ savedetail : true }); if (this.record) { this.on({ scope : this, render : { single : true, fn : this.loadFormAfterRender } }); } }, buildFormFields : function(container) { var tallyContainer = this.buildTallyContainer(can); return [ { xtype : 'hidden' ,name : 'tallyID' },{ xtype : 'hidden' ,name : 'container' ,id : 'container' <-- KEYFIELD If I make unhidden, my value is there ,itemId: 'container' }, tallyContainer ]; var can=Ext.getCmp('container').getValue(); <--UNDEFINED //var can=Ext.get('container').getValue(); } ,buildTallyContainer : function(can) { console.log(can); return { xtype : 'container' ,layout : 'column' ,defaultType : 'container' ,anchor : '-10' ,defaults : { layout : 'form' ,labelAlign : 'top' ,anchor : '-10' ,layoutConfig :{ labelStyle : 'font-weight:bold;text-align:center;border:1px solid navy;' ,labelSeparator : '' } } ,items : [ { width: 110 ,items: { xtype: 'combo' ,fieldLabel: 'PO #' ,name: 'comboPO' ,displayField:'poID' ,allowBlank: false ,valuefield: 'poID' ,hiddenName: 'poID' ,triggerAction:'all' ,width: 109 ,store: { xtype: 'jsonstore' ,url: '?c=lookup&m=canPOList&can='+can <---- THIS IS THE VARIABLE ,autoLoad: false ,root: 'data' ,fields: ['container','poID','crates','transitStatus'] } } },{
-
7 Jul 2010 10:30 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,170
- Vote Rating
- 32
1) Do not use Ext.getCmp inside of your classes.
2) Why would you want to get the value before you've set it?!!?
3) The instance of Ext.form.HiddenField has not been created yet.
4) See below image:


Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
7 Jul 2010 10:42 AM #3
@OP See the ref config
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
7 Jul 2010 10:49 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,170
- Vote Rating
- 32
ref won't help him because of the order in which he's trying to use it.


Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
7 Jul 2010 10:54 AM #5
So my presumption is correct, you validated that. So it goes to my question, where/how should i pick up the value once the form is rendered to pass it to my combo? This is based on your code from the book (yes I purchased).
It is like I associate employee with dept in an earlier process. In the new cardpanel, I click on the department list and get dept info loaded into the form. the detail grid on the form contains data about employees that are already part of the department. So I click NEW and have it pass the dept ID into the hidden container, the EmployeeEditorWindow form has a combobox with THAT dept's employees.
Does that make sense?
In my case:
I populate the form from a master grid on the West. I then click "NEW" on the detail grid (which opens a new form for data input) and pass the container(keyfield) to the hidden. On an earlier process I have already associated poID's with containers.
Now I want to add Item detail to the DB, so when I click NEW, I want only those PO's that are associated with the "container" to be listed in the combobox.
-
7 Jul 2010 11:00 AM #6
Reference
Reference
I may have some bad references still hanging around because I have tried to pass it several ways. I use this function to pass the keyfield data into the EditorForm (from the "Manager")
This populates the hidden "container" field on the form.
Code:,onFormNewDetail : function(transitForm) { var container = transitForm.getValues().container; new STS.TallyEditorWindow({ container: container ,listeners : { detailsaved : { single : true, scope : this, fn : this.detailSaveSuccess } } }).show(); }
-
7 Jul 2010 3:44 PM #7
SOLVED: Thanks for not calling me out
SOLVED: Thanks for not calling me out
From the class that loads the form, I pass the container, then simply use the variable....was making it too complicated before.....
first call to build form:
Then in formCode:buildDetailForm : function() { return { xtype : 'tallydetailform' ,border : false ,itemId : 'tallydetailForm' ,record : this.record ,container: this.container ,tbar : null }; },
Code:,items: { xtype: 'combo' ,fieldLabel: 'PO #' ,name: 'comboPO' ,displayField:'poID' ,allowBlank: false ,valuefield: 'poID' ,hiddenName: 'poID' ,triggerAction:'all' ,width: 109 ,store: { xtype: 'jsonstore' ,url: '?c=lookup&m=canPOList&can='+this.container ,autoLoad: false ,fields: ['poID'] } }
Similar Threads
-
Variable Placement? Controlling Memory Usage.
By cluettr in forum Ext 1.x: Help & DiscussionReplies: 11Last Post: 3 Dec 2009, 9:11 PM -
[Solved] store url variable for virtual site
By mohaaron in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 18 Jun 2009, 11:11 AM -
Work with php and need to send a variable of a tab1 to tab2 by url and load a form
By operador in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 31 Jan 2008, 2:30 PM -
How to variable sending by url tab2 from a html form
By operador in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 30 Jan 2008, 11:28 AM -
Work with php and need to send a variable of a tab1 to tab2 by url and load a
By operador in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 30 Jan 2008, 9:00 AM


Reply With Quote