1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    3
    Vote Rating
    0
    mihajloj is on a distinguished road

      0  

    Default 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>

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    maybe set and read the URL parameters?

Similar Threads

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

Thread Participants: 1

Tags for this Thread