RRListView - a CListView extension to allow Ajax browser history
#41
Posted 04 June 2011 - 01:56 PM
jQuery JavaScript Library v1.5.1
#42
Posted 10 June 2011 - 07:08 AM
I've modified it yet again so that it can be more customisable.
As far as I know it works ok, but I would obviously appreciate your feedback on it.
The extension page is here, with a detailed usage description.
@pcs2112 - please try this latest version, then come back to me if you still have problems.
#44
Posted 10 June 2011 - 01:43 PM
chux, on 10 June 2011 - 08:27 AM, said:
With pleasure - glad it helped you!
#45
Posted 11 June 2011 - 12:30 AM
Thanks for taking the time, i'll post feedback once i try it.
#46
Posted 14 June 2011 - 03:15 AM
It turns out that upgrading to JQuery 1.6.1 got rid of these problems, so I'm assuming that it is something to do with the attr and prop method bugs from JQuery 1.5.1, although as I said I haven't searched any further.
Just in case anyone is having similar problems...
#47
Posted 14 June 2011 - 10:16 AM
I just plugged it into my app, which uses several custom filters in the grid (and outside of it too), and it just worked.
I am really grateful as it saved me a lot of work - I didn't expect it to work as well as it did.
Tons of Kudos from me.
This has to be the most useful extension overall.
I am using it at http://tracker.ogito.../bugitor/issues
#48
Posted 14 June 2011 - 12:23 PM
jacmoe, on 14 June 2011 - 10:16 AM, said:
I just plugged it into my app, which uses several custom filters in the grid (and outside of it too), and it just worked.
I am really grateful as it saved me a lot of work - I didn't expect it to work as well as it did.
Tons of Kudos from me.
This has to be the most useful extension overall.
I am using it at http://tracker.ogito.../bugitor/issues
You've got me blushing there
Seriously, I'm glad it came in helpful, and I'm glad to see it being used in a serious application - do let me know if anything doesn't work as expected, and whether you think my philosophy with regards to merging query parameters and hash parameters rather than having separate widget states is the right or wrong way...
#49
Posted 25 August 2011 - 10:28 AM
pcs2112, on 04 June 2011 - 12:02 AM, said:
they are no working for me.
here is the javascript
jQuery('#yw1').yiiGridView({'ajaxUpdate':['yw1'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'items','selectableRows':1,'hashHistory':true,'pageVar':'League_page','sortVar':'League_sort'});
});
PHP code
<?php
$data = $model->search();
$data->pagination->pageSize = $this->module->gridPageSize;
$this->widget('application.extensions.RRGridView.RRGridView', array(
'dataProvider'=>$data,
'filter'=>$model,
'columns'=>array(
array(
'name' => 'id',
'type' => 'raw',
'value' => 'CHtml::link($data->id, $data->getUrl(), array("target" => "self"))',
),
'league_name',
'league_abbr',
'madden_version',
'franchiseId',
'currYear',
'currSeason',
'currWeek',
'state',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
these are the js files included in the page
<script type="text/javascript" src="/assets/dc20fa88/gridview/jquery.yiigridview.js"></script>
<script type="text/javascript" src="/assets/9ed78e3e/jquery.rr.hashhandling.js"></script>
<script type="text/javascript" src="/assets/9ed78e3e/jquery.rr.yiigridview.js"></script>
No errors are reported but pagination and sorting don't work, giving my grid an id doesn't help
I am having the same issue. No errors... just appends the #
#52
Posted 26 August 2011 - 02:53 AM
andyofb, on 26 August 2011 - 02:50 AM, said:
Ok, so please include the code you use for the GridView, as well as any custom model or controller code (that differs from the gii generated code), for example if you are using some kind of custom attributes in the gridview.
#53
Posted 21 October 2011 - 01:12 PM
#54
Posted 23 October 2011 - 03:02 AM
alrissala, on 21 October 2011 - 01:12 PM, said:
Hello.
Glad it helped. However, I only ever use the path urlFormat and don't have any problems.
I think your problem must come from something else.
Feel free to post some error messages and code about it.
#55
Posted 24 October 2011 - 08:35 PM
i just want to notify you that there is a conflict with facebook comments plugin.
i created an image gallery for a client and used your extension to navigate images with ajax.
if there are comments in the same page as the extension, facebook will add some GET param and invoke a js call which will add a hash to the url removing your hash, and the extension will navigate to the first page when the hash is changed to facebook's hash.
trying to navigate to other pages using the extension will not work, because facebook takes control over the hash and changes it back.
an example you can see:
the page working fine:
sahar-rouhana.com/albums/images/158?ajax=enable&fb=10321&imp=5#Images_page=5
the link from facebook will generate the problem:
sahar-rouhana.com/albums/images/158?ajax=enable&fb=10321&imp=5&fb_comment_id=fbc_10150342218458300_19989195_10150345895478300#Images_page=5
any ideas will be appreciated.
#56
Posted 25 October 2011 - 12:28 AM
khoury, on 24 October 2011 - 08:35 PM, said:
i just want to notify you that there is a conflict with facebook comments plugin.
....
Thanks.
I'll try and have a look at it when I get the time (I'm quite busy at the moment).
I haven't used the Facebook plugin, but as far as I remember, my extension should play nicely with anything else that uses the hash (as long as the parameter names don't conflict) - I don't think I ever replace or remove the hash, and when a hash change is detected it will only trigger an ajax action if it involves one of the registered parameters, so without having looked into it, I would guess that it is the Facebook plugin which is overriding the hash, in which case that is what would need to be corrected.
The other scenario is that the Facebook plugin uses CListView or CGridView in which case there might be a problem because my extension overrides the Javascript for those widgets, in which case I would perhaps have to see about completely separating it from them.
#57
Posted 17 December 2011 - 04:35 PM
Here is my code:
<?php
$this->widget('ext.RRViews.RRGridView', array(
'id'=>'customer-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
//'ajaxUpdate'=>true,
//'ajaxUrl'=>CHtml::normalizeUrl(Yii::app()->createUrl('/customer/customeradminplain')),
'cssFile' => Yii::app()->baseUrl . '/css/gridview/styles.css',
//'afterAjaxUpdate' => 'function(id,data){ alert(id) }',
//'selectionChanged'=>'jumpToUpdate',
'selectableRows'=>2,
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'value'=>'$data->customer_id',
'id'=>'customer_id',
),
array(
'class'=>'CButtonColumn',
'template'=>'{update}',
'header'=>'edit',
'updateButtonUrl'=>'Yii::app()->createUrl("/customer/update", array("id" => $data->customer_id))',
),
array(
'name'=>'cus_name',
'type'=>'raw',
'value' => '$data->cus_name .", ". $data->cus_prename',
// 'htmlOptions'=>array(
// 'style'=>'width:230px',
// ),
),
/*array(
'name'=>'status',
'value'=>'CHtml::encode($data->status)',
'filter'=> SWHelper::allStatuslistData($model),
),*/
//'customer_id',
//'parent_customer_id',
//'cus_number',
// array(
// 'name'=>'cus_prename',
// 'htmlOptions'=>array(
// 'style'=>'width:230px',
// ),
// ),
array (
'name' => 'addresses_add_street',
'type' => 'raw',
'value' => 'CHtml::Link($data->addresses[0]->add_street.CHtml::image(Yii::app()->request->baseUrl."/images/edit.png"),
"",
array(
"onClick" => CHtml::ajax(
array(
"type" => "POST",
"url" => "js:$(this).attr(\'href\')",
"update" => "#divForForm",
"success"=>"js:function(){
addAddress._updateAddress_url = \'".Yii::app()->createUrl("/address/update",array("id"=>$data->addresses[0]->address_id))."\';
addAddress();
$(\"#dialogAddress\").dialog(\"open\");
}",
)
),
"style"=>"text-decoration:none; cursor:pointer",
)
)',
'htmlOptions'=>array(
'style'=>'width:170px',
),
),
array (
'name' => 'addresses_add_town',
'value' => '$data->addresses[0]->add_town',
'htmlOptions'=>array(
'style'=>'width:100px',
),
),
array (
'name' => 'communications.com_value',
'type' => 'raw',
'value' => 'CHtml::Link($data->communications[0]->com_value.CHtml::image(Yii::app()->request->baseUrl."/images/edit.png"),
"",
array(
"onClick" => CHtml::ajax(
array(
"type" => "POST",
"url" => "js:$(this).attr(\'href\')",
"update" => "#divForForm",
"success"=>"js:function(){
addCommunication._updateCommunication_url = \'".Yii::app()->createUrl("/communication/update",array("id"=>$data->communications[0]->communication_id))."\';
addCommunication();
$(\"#dialogCommunication\").dialog(\"open\");
}",
)
),
"style"=>"text-decoration:none; cursor:pointer",
)
)',
/*'htmlOptions'=>array(
'style'=>'width:100px',
),*/
),
'cus_newsletter',
array(
'class'=>'EButtonColumnWithClearFilters',
'template'=>'{delete}',
'deleteButtonUrl'=>'Yii::app()->createUrl("/customer/delete", array("id" => $data->customer_id))',
),
)
));
$this->endWidget();
?>
And I use this code inside the model:
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->with=array('addresses'=>array('together'=>true),'communications'=>array('scopes'=>'mainphone'));
$criteria->compare('customer_id',$this->customer_id);
$criteria->compare('parent_customer_id',$this->parent_customer_id);
$criteria->compare('vdsite_id',$this->vdsite_id);
$criteria->compare('paymenttype_id',$this->paymenttype_id);
$criteria->compare('user_id',$this->user_id);
$criteria->compare('cus_number',$this->cus_number,true);
$criteria->compare('LOWER(cus_name)',strtolower($this->cus_name),true);
$criteria->compare('LOWER(cus_prename)',strtolower($this->cus_prename),true);
$criteria->compare('cus_birthdate',$this->cus_birthdate,true);
$criteria->compare('cus_gender',$this->cus_gender);
$criteria->compare('cus_creationdate',$this->cus_creationdate,true);
$criteria->compare('cus_deleted',0);
$criteria->compare('status',$this->status,true);
$criteria->compare('cus_uid',$this->cus_uid,true);
$criteria->compare('cus_company_type',$this->cus_company_type);
$criteria->compare('cus_company_number',$this->cus_company_number,true);
$criteria->compare('cus_securitycheck',$this->cus_securitycheck);
$criteria->compare('cus_barcode',$this->cus_barcode,true);
$criteria->compare('cus_invoice',$this->cus_invoice,true);
$criteria->compare('cus_newsletter',$this->cus_newsletter,true);
$criteria->compare('addresses.add_town',$this->addresses_add_town,true);
$criteria->compare('addresses.add_street',$this->addresses_add_street,true);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'cus_name ASC',
),
'pagination'=>array(
'pageSize'=>50,
),
));
}
And don't forget the controller:
public function actionCustomerAdmin()
{
$model=new Customer('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Customer']))
$model->attributes=$_GET['Customer'];
$this->render('_customer_admin',array(
'model'=>$model,
));
}
Thank you for your help! Cheers Phil
I'm using the latest yii - version from google svn...
#58
Posted 03 January 2012 - 07:51 AM
I have a serious problem with rrviews, after upgrading to yii 1.9 ->looks like some of the js api has changed, so some of your code isn't working any more:(
I'm sorry to say, but my js-skills aren't good enough to fix it...
Regards Philipp
#59
Posted 03 January 2012 - 08:23 AM
Try that first

Help













