Slow Bandwidth Solution To Selecting Many Items

Hello Yii Friends,

I am working on a website that must function well in low-bandwith situations (the website will be used in developing countries). I need some help with ideas for a page with the following requirements:


[*]A user has 1,000 clients stored in their database.

[*]The system displays a list of all the clients.

[*]The user indicates/marks some or all of the clients as being served (no communication occurs over the Internet with server during this process)

[*]The user tells the system to save the list of served and not served clients.

[*]The system saves the data and informs the user.


I am currently using a CGridView with buttons to select and unselect a client. A controller method is called when a client’s selection status is changed via one of the buttons. The buttons look like checkboxes, and only one is displayed at a time. This is proving to be very reliable, easy for the users, and too slow for use in environments with low bandwidth.

I have been thinking about trying to use two list boxes. Where a user can move clients from one "Not Served" list box to the "Served" list box. Then the data would only be communicated to the controller when a user clicks a submit button.

Thanks in advance for any help,


Why not use a CGridView with a CCheckBoxColumn added to it? Then the user can check off all served clients, hit the submit button and the controller processes each checked row server side. The only bandwidth you’ll then have is the form submission.

In pseudo code, your controller action would look something like this:

public function actionClients()


    if isset POST


        foreach submitted checkbox

            update the model

            save the model

        redirect to desired page


    render the form


Make sure to enclose the whole CGridView within the form.

I think this will only work for a single CGridView page. AFAIK, when you move to another page (Ajax or regular POST), the previous page’s selection will be lost. You’ll need to keep a record, in javascript, of selected boxes until you submit. Can someone confirm this?


@Matt, You are correct.

That should be pretty easy, especially with jQuery. I would submit the result set with Ajax - saving more bandwidth.


That’s what I like to hear - easy! :slight_smile:

Do you mean it would be easy to keep a list of the selected items when moving from page to page?

Yes. I would extend CGridView. This widget should generate a grid, a submit button, and inject some JS into the page keep track of the selected items. The submit button would send the list (ids?) to the controller. I’ve gotta run to work now but will try to come up with something tomorrow.



Sorry - haven’t had a chance to look into it. Did you come up with a solution yet?

Not yet. I am also busy working on another project. I was trying to let this bubble around in my head so that I might think of a super clever idea.

So far, I have not changed the basic interface that I am using. Although I did find some simple ways to speed things up a bit in low bandwidth situations:


[*]I turned off debug mode in production.

[*]I compressed by CSS files with the extension DynamicRes