I believe adding the URL parameters to the function: DataGrid :: SetHttpGetVars() will do the job.
Before the call to to
$dgrid->Bind(); add:
$dgrid->SetHttpGetVars(array('option', 'Itemid'));
Off Topic:
I must add however that there is an XSS injection vulnerability in the DataGrid code that handles this. You have to take that up with the developers.
On line 3602:
echo "<input type='hidden' name='".$key."' id='".$key."' value='".((isset($_REQUEST[$key]))?$_REQUEST[$key]:"")."'>";
Should be changed to:
echo "<input type='hidden' name='".$key."' id='".$key."' value='".((isset($_REQUEST[$key]))?htmlentities($_REQUEST[$key], ENT_QUOTES, 'UTF-8'):"")."'>";
line 3636:
$a_url .= $key."=".((isset($_REQUEST[$key]))?$_REQUEST[$key]:"");
should be changed to:
$a_url .= $key."=".((isset($_REQUEST[$key]))?htmlentities($_REQUEST[$key], ENT_QUOTES, 'UTF-8'):"");
or similar code to convert HTML to corresponding HTML entities.