开发者

Sorting a view by dropdown

开发者 https://www.devze.com 2023-01-30 11:42 出处:网络
Hey, i\'ve been looking around for a ajax dropdown sorter for my Views in Drupal. Unfortunatly, i ha开发者_开发知识库ven\'t found alot of usefull information about this subject.

Hey, i've been looking around for a ajax dropdown sorter for my Views in Drupal.

Unfortunatly, i ha开发者_开发知识库ven't found alot of usefull information about this subject.

Can anyone tell me if theres a solution already available or can help me started on a custom module by telling me which hooks i should use?


I had a similar issue. Unfortunately I wasn't able to sort the data from the database which is by far the best way. I was however able to take the data and sort it with PHP using a preprocessor function. Depending on the name of your view, setup a function similar to the following:

function templatename_preprocess_name_of__view(&$vars)
{
    //Super sweet sorting code goes here
}

The name of your view needs to follow the name of the template file that it is driven by, if there isn't on you should create one. Make sure to change dashes to underscores in your function name. Hope this is helpful. If you find a way to do it from the DB I'm all ears because that would be super awesome.

0

精彩评论

暂无评论...
验证码 换一张
取 消