passing parameters to the Yii action that builds the grid

I am trying to integrate a grid into a Yii based PHP application.
The javascript code I use to create the grid is:

and the Yii PHP code server-side is:

public function actionGrid_data()
{
            $res=mysql_connect("localhost","root","root");
            mysql_select_db("448695_foundation");
            $grid = new GridConnector($res, "MySQL");
            $config = new GridConfiguration();
            $config->setHeader("Username,First Name,Last Name,Email");
            $config->setInitWidths('150,150,150,*');
            $config->setColTypes("ro,ro,ro,ro");
            $grid->set_config($config);
            $sql = "SELECT username, firstname, lastname, email
                        FROM User
                            INNER JOIN AuthAssignment ON userid = id;
            $grid->render_sql($sql,"id","username,firstname,lastname,email");
}

It works fine, but now I need to add a WHERE clause to the SQL statement to filter out the non-relevant records. The SQL statement should become:

“SELECT username, firstname, lastname, email
FROM User
INNER JOIN AuthAssignment ON userid = id
WHERE itemname = '” . $itemname . " '";

I cannot figure out how to pass the $itemname parameter to the actionGrid_data function.

Can anyone please help, thanks.

From which place of app itemname value must be provided?

If it need to be set from client side, you can embed it in data loading url. actionGrid_data is the normal controller method, so you can access url’s parameters in the same way as for any other YUI controller

mygrid.loadXML("./grid_data?itemname=123");

Thank you! I was trying to pass a parameter to the function rather than to the url, now it works!