Page 1 of 1
CGridView + ajax
#1
Posted 09 March 2010 - 03:54 AM
How can I update the content of a CGridView with an ajax action? I want to fetch new items from database and add them to the grid with ajax.
#2
Posted 09 March 2010 - 07:19 AM
#3
Posted 10 March 2010 - 07:14 AM
bettor, on 09 March 2010 - 07:19 AM, said:
are you talking about filtering...sorting...
please provide what you've developed so far and where you got stuck.
please provide what you've developed so far and where you got stuck.
I have an application which writes new entry in the database, and after writing I want to refresh the CGridView without loading the page again.
#5
Posted 10 March 2010 - 11:43 AM
Update content in AJAX with partialRender
You should be able to modify this Cookbook entry to get what you need too.
You should be able to modify this Cookbook entry to get what you need too.
#6
Posted 12 March 2010 - 06:38 AM
What I want to do is to update CGridView periodically without loading the page every time. I still don't know how to achive that. I think it must a javascript funciton call with "setInterval", but I don't know which function to call with interval.
#7
Posted 12 March 2010 - 08:22 AM
You need to write js code that can periodically call: $.fn.yiiGridView.update(gridID)
#8
Posted 12 March 2010 - 08:36 AM
qiang, on 12 March 2010 - 08:22 AM, said:
You need to write js code that can periodically call: $.fn.yiiGridView.update(gridID)
If I do so, I always get an error: $.fn.yiiGridView is not undefinded
I have the following code:
<script type="text/javascript">
function refreshList()
{
$.fn.yiiGridView.update('#yw0');
}
var interval = setInterval("refreshList()", 2000);
</script>
#9
Posted 12 March 2010 - 08:44 AM
Check your HTML source code to make sure jquery.yiigridview.js is included (it should if you use CGridView).
Share this topic:
Page 1 of 1

Help














