One column is CCheckBoxColumn. I would like to initially check all boxes. By setting the ‘checked’ attribute to ‘true’, all boxes are checked except the header. I read the source code. None of the cases in renderHeaderCellContent() would initially set ‘checked’ to true. If there any approach to do this on PHP side?
I want to enable pagination and sorting. I use CArrayDataProvider because my data source is from external API. The data is fetched according to user’s input, which is passed with POST method in ajax call. The problem is, the pagination ajax call is done in GET. In this call, I do not have the user input. How do I reconstruct the CArrayDataProvider? Should I save the user input somewhere (session? cache?), or save the data retrieved from API?
Below is a pseudo code of the function
function actionShow()
{
if (isset($_POST['user_input']))
{
$data = call_api($_POST['user_input']);
$data_provider = new CArrayDataProvider(data, array(
'keys' => array('data'),
'pagination' => array(
'pageSize' => 10,
),
));
$this->renderPartial('index', array('data_provider' => $data_provider), false, true);
}
else
throw new CHttpException(500);
}
Thanks for answes. I personally think subclassing is not a good idea, since I need to maintain the code every time I update Yii. Would it be possible that Yii officially adopts your code in future releases? Hard coding "false" is not flexible, right?
Sorry. I was restricted for the first-day post quota.
I do not understand your code. What is $_GET[‘gridId’]? The only GET parameters I receive in my case are ajax = “yw0” and “page = <page_number>”. The API is provided by 3rd-party (e.g. Twitter, Facebook). I cannot reconstruct the “user_input” from $_GET[‘gridId’].
I also do not plan to store the user input in session because of its sensitivity (password related).
When I navigate to the second page, the only GET parameters I get are
ajax => test
page => 2
$_GET[‘test’] does not work.
Is there some way I can access the data in the grid, given its grid ID? Or is there some way I can temporarily store the grid data in full, and automatically destroy after the user leave the web page?