Reputation: 5426
I am using the data module to allow searching and filtering of table data. I am using views to display the data in a table with 3 exposed filters.
I want the user to select from specific values in 2 of the 3 filters. But I am currently only able to display a text box that allows the user to type a value.
Upvotes: 0
Views: 3251
Reputation: 46
You'll want to check out hook_views_pre_render(). Use it at first in conjunction with dpm() from the devel module to explore the view structure. Then you can directly alter the view (and its filters) before sending it on to be rendered. I would recommend using a php function, like array_unique(), or your own custom function, to loop through and uniquefy your results.
mymodule_views_pre_render(&$view) {
// make sure devel module is turned on first, then take this out when you're
// done exploring the view results
dpm($view);
// this part is pseudocode, I haven't memorized the view structure, but dpm() will
// show you what to actually put here
if( $view->name == "my_target_view_machine_name" ) {
// do your uniquefying here
}
}
Upvotes: 2
Reputation: 109
When adding an exposed filter to a view, drupal gives you two options(Filter type expose): Single filter and Grouped filter, if you choose the Grouped filters, it will let you choose what type of widget do you want.(Radios/Select)
Upvotes: 1