Results 1 to 4 of 4

Thread: How to pass variable to php

  1. #1
    Sencha User
    Join Date
    Sep 2009
    Posts
    29

    Default How to pass variable to php

    Hi everyone,

    i have a grid displaying data from xml, which is build using php file.
    I would like to add a combobox, and function "on change" which will pass data from it to that php file and reload my Grid.
    I guess it is simple, but it's not working for me at all.

    I would like to pass string from ComboValue variable into my report.php
    But i don't get anything using $_GET['ComboValue'].

    Thanks for any help
    D.

    Code:
    var combo = new Ext.form.ComboBox({
    ...
    })
    
    var store = new Ext.data.Store({
        url: 'report.php',
        reader: new Ext.data.XmlReader({record: 'ROW'},
            [
           {name: "node", mapping:"NODE_NAME"},
           {name: "util_in", mapping:"UTIL_IN"},
           {name: "util_out", mapping:"UTIL_OUT"}
          ])
    
    var grid = new Ext.grid.GridPanel({
    ...
    });
    
    combo.on('select', function(){
        store.load({
            params: {
                ComboValue: combo.getValue()
            }
        });
    });

  2. #2
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,675

    Default

    use the change event of combobox, make an ajax request to receive what ever you need.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Posts
    29

    Default

    Im just trying to re-load the grid, using php file.
    This code below should do this, no ? Send ComboValue to report.php...
    store.load({params: {ComboValue: combo.getValue()}

    Thanks

  4. #4
    Sencha User
    Join Date
    Jan 2008
    Location
    Maryville, IL, US
    Posts
    288

    Default

    start with console (firebug is your friend). Use log() to make sure you are getting combo.getValue() correctly.
    also, make sure the load call isn't getting "POSTed", by setting the method properly.
    finally, look at using the default parameters of the select listener for combo (combo, record, index) to prevent scope issues.

    Code:
    combo.on( "select", function (c,r,i) {
        if (!Ext.isIE) {
            // can't see how combo is configured; do you need getRawValue() instead?
            console.log( "load store with param : ",c.getValue() ) ;
        }
    
        store.load( { 
            method: "GET", 
            // can't see how combo is configured; do you need getRawValue() instead?
            params: { ComboValue: c.getValue() } 
        } ) ;
    } ) ;
    ps. While your above code may not be complete, you are forgetting to close your store code properly (missing brace and parenthesis).
    Last edited by httpdotcom; 11 Jun 2010 at 5:03 AM. Reason: formatting

Similar Threads

  1. How to pass date time variable to C#?
    By agi_kakkoii in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 13 Jul 2009, 7:51 PM
  2. pass variable from php file to js file
    By elona in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 10 Mar 2009, 5:22 AM
  3. Pass Form Value as Param by ID, not by Variable
    By adbox in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 8 Mar 2009, 3:24 PM
  4. How can i pass a variable throught an event.
    By YargicX in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 3 Apr 2008, 1:03 AM
  5. pass variable to php
    By ibme74 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 29 Oct 2007, 10:37 PM

Posting Permissions

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