DropDownList data sorting

Hi

I am trying to work out the best way of creating a sorting functionalty for my database call.

What I need is a dropdownlist where the user can select how they want there data to be ordered I.e by data ascending or descending order then using ajax preferably it will alter the data automatic or just re-render the page with with a applied get variable for the database call criteria.

I am able to do this by writing out the html form however I want to use the CactiveForm widget or the easiest method to achieve this.

Dose anyone have any advice?

I was struggling with a similar problem. I had a list of content blocks that I wanted to display with several options for sorting and filtering.

The solution I chose was to use JPlist.js.

HOWEVER, if you have a large data set to sort through, this may not be a good solution for you.

With Jplist.js I just format and send to the users PC the whole list of options. In my case up to a couple of hundred. Then let javascript provide the sorting and filtering options.

On a low powered user machine this may slow things down.

I have found that the time yii spends putting together a large data set to send to the client, is not

meaningfully longer that putting together a small dataset for sets under 200 records.

-John

Hello everyone…

I am also trying to resolve this type of problem.There two text box and one submit button. I just want to need all the cities shows in first text box using autocomplete from database and in second text field shown the related area corresponding to the first text box.

just like foodpanda.in

Hm, this can be resolved and implemented in 10 different ways, and it lot depends on your requirements. Notice that all Yii widgets (CListView) are having built in support for sorting, pagination, they are automatically translated to other languages etc. and I find them extremely useful. These widgets can be customized and are very "powerful" in conjunction with CActiveDataProviders and SQLDataProviders.