thanks… yeah i know, a newbie question…
i still can’t get this to work… maybe i’m going about it the wrong way…
what i am trying to do is create a screen like the GII generated admin screen for a model called ‘promos’… i get the screen to show fine but i just want to fine tune it a bit to only show SOME of the records on the promos model/table - not all of them… so i created a new dataProvider in my controller that looks like this:
public function actionPromosList() {
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$model = new Promos();
// $model->unsetAttributes(); // clear any default values
if (isset($_GET['Promos'])) {
$model->attributes = $_GET['Promos'];
}
$this->user = Users::model()->find('businessID');
$dataProvider = new CActiveDataProvider('Promos', array('criteria' => array(
'condition' => Promos::model()->businessID == $this->user->businessID)));
$this->render('promoslist', array(
'model' => $model,
'business' => $this->user->businessID,
'dataProvider' => $dataProvider
));
}
what i’m trying to do here is select records from the promos table that match the businessID of the person who is logged in (from the Users model/table)… ignore the other parameters that i am passing to this screen, like the model and business - i’m using them for displays there. in the promoslist program the coding looks like this:
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'promos-grid',
'dataProvider' => $dataProvider,
// ‘filter’ => $model,
'columns' => array(
'id',
'offerCode',
'value',
'details',
'startDate',
'endDate',
'maxOffers',
array(
'class' => 'CButtonColumn',
),
),
));
but i am still getting ALL of the records from the Promos model/table to show on this new screen - it is not showing just the promos for the logged in user.
screen can be seen at http://demo.engajdloyalty.com/index.php/promos/promoslist - it may be up or down as i’m testing all sorts of ideas…