Get Dataprovider Array In Afterajaxupdate Event

I need the dataprovider data in afterajaxupdate call how can get ?

I am doing ‘afterAjaxUpdate’=>‘function (id,data){ alert(data);}’, but it is giving me all the file content

I need only the updated array of dataprovider for that particular page.

Can anyone tell me how to do this ?

Or any alternate method.

Hi, welcome to the forum.

You mean ‘afterAjaxUpdate’ of CGridView or CListView?

Well, ‘data’ in this function refers to the data that has been sent by the ajax response. By the default implementation of ‘admin’ page, it is the HTML of the whole page. If you want, you can send the partial HTML only for the grid view when you respond to the ajax call. Still, it has to be in HTML format, because the javascript that updates the grid view expects the ajax response to be HTML.

And, the data provider is not the data itself.

Hey thanks for your reply.

actually it is afterAjaxUpdate of CListView .

Not much difference between the two. The javascript of CListView will use HTML formatted data to update its contents via ajax.

In your afterAjaxUpdate, you could easily retrieve the updated values of CListView items using jQuery’s queries without peeking response data directly, because they have been already updated. Isn’t that enough?

What exactly do you want to do with afterAjaxUpdate?

I have a map view and list view in the search result page.

In map view I am using google map and markers to mark the places.

In list view I am using CListview to display the listing but I want the Map view also updated as I

go to next page via ajax pagination, so I was thinking of getting the dataprovider array passing to other

ajax call to update the map view.I do not want to refresh the page.


I see.

Reconsider the way you set the markers for the first page.

Probably you are writing the parameters directly into the script on the server side … it works good only for the first page.

Instead you could write a javascript function to set/update the markers by reading the html entities of the list. Then you could call it for the first page and the ajax-updated pages.