-
5 Aug 2010 6:59 AM #1
Passing Params from a Host Page to Ext JS
Passing Params from a Host Page to Ext JS
Can someone please suggest an elegant way of passing parameters from a host page to an Ext JS file? My problem is: I am attempting to integrate some cool Ext JS components to an existing app writing primarily using Java Server Faces (JSF, MyFaces impl). I have written a fairly simple JS code to open a window, but since this window needs to be rendered inside of a MyFaces table component (iterating over a Collection), I need a way of obtaining the row index of the row on which the user clicked.
Perhaps another way of asking this question is: are there other ways I can attach Ext JS user interface to a host page? So far I've only been using a DIV element, and can't think of an easy way to pass a parameter using that.
Here is my Ext JS code:
Code:Ext.onReady(function() { var formPanel = new Ext.FormPanel( { items: [ { checked: true, fieldLabel: 'Yes', boxLabel: 'Yes', xtype: 'radio', name: 'radioField', inputValue: 'Y' }, { fieldLabel: 'No', boxLabel: 'No', xtype: 'radio', name: 'radioField', inputValue: 'N' } ], buttons: [ { text: 'Submit', handler: function() { formPanel.getForm().load( { url: 'myTestServlet?param=' + document.getElementById('myForm:rowIdx').getValue(), waitMsg: 'Loading' }); } }, { text: 'Cancel', handler: function() { w.hide(); } } ] });var w = new Ext.Window( { title: 'Demo', collapsible: true, maximizable: true, width: 370, height: 490, minWidth: 185, minHeight: 245, layout: 'fit', items: formPanel });var subjectId = 1;var b = new Ext.Button( { text: '+', handler: function() { alert(subjectId); w.show(); }, renderTo: 'div-element' });});
and here is an excerpt from my host html page:
Code:<t:dataTable id="table" styleClass="recordSetTable" headerClass="resultSetTableHeader" rowClasses="cellDataAltRow,cellDataFirstRow" renderedIfEmpty="false" var="row" preserveDataModel="false" value="#{bean.rows}" rows="#{bean.numOfRowsToDisplay}" sortColumn="#{bean.sortColumn}" sortAscending="#{bean.sortAscending}" preserveSort="true" disabled="#{!bean.editable}"> <!-- Render columns... --> <div id="div-element" /> </t:dataTable>
-
5 Aug 2010 7:55 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
maybe set and read the URL parameters?

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.
Similar Threads
-
Error in passing params in Ext.Ajax.request
By ritesh.kapse in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 19 Feb 2009, 8:25 AM -
Ext.get and passing params
By m0rd0 in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 10 Jul 2008, 7:57 AM -
[HELP] Passing extra params to Ext.menu.Menu
By Phunky in forum Ext 2.x: Help & DiscussionReplies: 13Last Post: 7 Feb 2008, 9:13 AM -
passing params to DWRPRoxy
By s.kerroumi in forum Community DiscussionReplies: 1Last Post: 4 Jan 2008, 6:26 AM


Reply With Quote