Yii Framework Forum: RRListView - a CListView extension to allow Ajax browser history - Yii Framework Forum

Jump to content

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

RRListView - a CListView extension to allow Ajax browser history Rate Topic: -----

#41 User is offline   pcs2112 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 31-July 10

Posted 04 June 2011 - 01:56 PM

im using the latest version of the framework.

jQuery JavaScript Library v1.5.1
0

#42 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 10 June 2011 - 07:08 AM

Ok guys, I've finally put this together as an extension.
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.
Rupert
1

#43 User is offline   chux 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 83
  • Joined: 16-September 10

Posted 10 June 2011 - 08:27 AM

@RedRabbit than you again for this extension. It had saved me a lot of time in my current project.
Give a read to my blog.
0

#44 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 10 June 2011 - 01:43 PM

View Postchux, on 10 June 2011 - 08:27 AM, said:

@RedRabbit than you again for this extension. It had saved me a lot of time in my current project.


With pleasure - glad it helped you!
Rupert
0

#45 User is offline   pcs2112 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 31-July 10

Posted 11 June 2011 - 12:30 AM

RedRabbit,

Thanks for taking the time, i'll post feedback once i try it.
0

#46 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 14 June 2011 - 03:15 AM

I've just come across a problem in the filtering, of which I haven't had the time or inclination to find out the actual cause, but basically I noticed that a less than filter on one of my columns was being ignored, but only in my production version, not the development version.

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...
Rupert
0

#47 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 14 June 2011 - 10:16 AM

Thank you for making this extension! :D
I just plugged it into my app, which uses several custom filters in the grid (and outside of it too), and it just worked. :lol:
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
"Less noise - more signal"
0

#48 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 14 June 2011 - 12:23 PM

View Postjacmoe, on 14 June 2011 - 10:16 AM, said:

Thank you for making this extension! :D
I just plugged it into my app, which uses several custom filters in the grid (and outside of it too), and it just worked. :lol:
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 :P
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...
Rupert
0

#49 User is offline   andyofb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 24-August 10

Posted 25 August 2011 - 10:28 AM

View Postpcs2112, on 04 June 2011 - 12:02 AM, said:

Hi,

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 #
0

#50 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 26 August 2011 - 01:01 AM

Ok, just as a preliminary check - are you actually using the extension version, or the version from this post?
The version to use is the one at Extension.
Rupert
0

#51 User is offline   andyofb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 24-August 10

Posted 26 August 2011 - 02:50 AM

yes i am using the extension version
0

#52 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 26 August 2011 - 02:53 AM

View Postandyofb, on 26 August 2011 - 02:50 AM, said:

yes i am using the extension version


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.
Rupert
0

#53 User is offline   alrissala 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 08-August 11

Posted 21 October 2011 - 01:12 PM

Hi, first thanks for this extension but i noticed that it doesn't work when the urlManager urlFormat property set to "path"
0

#54 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 23 October 2011 - 03:02 AM

View Postalrissala, on 21 October 2011 - 01:12 PM, said:

Hi, first thanks for this extension but i noticed that it doesn't work when the urlManager urlFormat property set to "path"


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.
Rupert
0

#55 User is offline   khoury 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 24-October 11

Posted 24 October 2011 - 08:35 PM

hi, thank you for the excellent extension.
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.
0

#56 User is offline   RedRabbit 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 183
  • Joined: 24-September 10

Posted 25 October 2011 - 12:28 AM

View Postkhoury, on 24 October 2011 - 08:35 PM, said:

hi, thank you for the excellent extension.
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.
Rupert
0

#57 User is offline   PinkBrainPlan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 06-February 11
  • Location:Austria

Posted 17 December 2011 - 04:35 PM

Hi, I don't know what I do wrong, but as I use RRViews, the Filter-Methods don't work anymore...

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...
0

#58 User is offline   PinkBrainPlan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 06-February 11
  • Location:Austria

Posted 03 January 2012 - 07:51 AM

Hi,

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
0

#59 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 03 January 2012 - 08:23 AM

You need to delete all in your assets directory whenever you upgrade. :)
Try that first
"Less noise - more signal"
0

#60 User is offline   PinkBrainPlan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 06-February 11
  • Location:Austria

Posted 03 January 2012 - 05:14 PM

Did that before... Doesn't help.. I have a ListView on the same page... could that be an issue...?

View Postjacmoe, on 03 January 2012 - 08:23 AM, said:

You need to delete all in your assets directory whenever you upgrade. :)
Try that first

0

Share this topic:


  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users