Search/filter/sort functions, how?

More
15 years 5 months ago #9718 by boegmunken
Lets say i have a category view with 5 fields and a few items, the first field is the title.

I can type for example "abc" in the search box and only the title fields that contains this phrase will show up. But how do I make it possible to filter the other fields?

I have tried enabling filter and advanced search on all fields that I'm using, but it isn't working.

I have also edited the category parameter to enable filtering, and marked the items I'm interested in and then saved.
Still can't search through the other columns.

I would also like to be able to sort each column in alphabetical order ascending/descending just by clicking on each column header. Is this possible?

Any clues?

Thanks in advance.

Please Log in or Create an account to join the conversation.

More
15 years 5 months ago #9787 by yopyop001
Hi,

I don't know exactly how the flexicontent text filter works, i will try to have a look soon.

May be a beginning :
Upgrade to the latest version ( code.google.com/p/flexicontent/d ... z&can=2&q= ) if you are not using it.

In the database, have a look in the table #__flexicontent_items_ext and verify that there is data in the 'search_index' column.
If not, you have to open all items in the administration and re-save them.

To sort your table may be you can use this script:
Code:
http://yoast.com/articles/sortable-table/

I didn't try it but may be it can help. If yes, don't hesitate to share the way to implement it on the Tips and Ticks Forum.

Regards

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago - 15 years 4 months ago #10245 by collacocca
Yeppa - cool tip - works fine!

Download www.joostdevalk.nl/code/sortable ... rtable.zip
put unzipped 'sortable.js' into …/components/com_flex…/assets/js/
set proper rights
put arrow images into …/images/stories/

add into new line #33 of 'category_items.php' of your template
Code:
<script type="text/javascript" src="<?php echo JURI::base().'components/com_flexicontent/assets/js'.DS?>sortable.js"></script>

change class param in line #90 - same file to
Code:
<table class="sortable flexitable" id="flexitable"

adjust the path to the arrow images in 'sortable.js' around line #12

et voilà - the category-view is sortable :D

Muchas gracias to yopyop001!

Somewhere over the drain flows…
Last edit: 15 years 4 months ago by collacocca.

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago #10258 by poolp
Merci ! :mrgreen:
Ca marche bien ! Mais il y a une petite erreur a changer :

add into new line #33 of 'category_items.php' of your template
Code:
<script type="text/javascript" src="<?php echo JURI::base().'components/com_flexicontent/assets/js/sortable.js'?>"></script>

Encore Merci !

-= Poolp =-
Joomla 1.7 + FlexiContent 2(b3 r907) + AiDaNews

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago - 15 years 4 months ago #10261 by collacocca
Well it depends on how you set up your path delimiter.
In our case 'DS' is the constant that holds the '/' to separate the path from the filename. Anyway- please format the path to the *.js file the way it works for your setup ;)

Another thing sucks - the date sort algorithm shows some strange behaviour and doesn't work if you combine date + time.
We'll see…

Somewhere over the drain flows…
Last edit: 15 years 4 months ago by collacocca.

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago #10267 by poolp
Oki Doki ;)
Thanks !

-= Poolp =-
Joomla 1.7 + FlexiContent 2(b3 r907) + AiDaNews

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago - 15 years 4 months ago #10276 by collacocca
OK a q&d solution to give an idea how to adjust the date sort function to other formats.
We use a single field for date+time the european way - 'dd.mm.yy - HH:MM Uhr' - looks like 31.12.10 - 23:59 Uhr

Change the regex pattern in line #119, 120 of sortable.js to -
Code:
if (itm.match(/^(\d{2}?)[\/\.\-]\s?([a-zA-z]{2,9}?)[\/\.\-]\s?(\d{2,4}?).*$/)){sortfn = ts_sort_date;} if (itm.match(/^(\d{2}?)[\/\.\-](\d{2}?)[\/\.\-](\d{2,4}?).*/)){sortfn = ts_sort_date;}
…just to be a bit more flexible

…append an additional 'else if' block to line #238 -
//we use the date/time separating dash in our format as anchor. Adjust it to whatever you need
Code:
} else if (date.substr(9,1) == '-') { // we use the date/time separating dash in our format as anchor if (europeandate == false) { // yyyy.mm.dd - HH:MM:SS dt = date.substr(6,4)+date.substr(0,2)+date.substr(3,2)+date.substr(13,2)+date.substr(16,2)+date.substr(19,2); return dt; } else { // 31.12.10 - 23:59 Uhr => 1012312359 dt = date.substr(6,2)+date.substr(3,2)+date.substr(0,2)+date.substr(11,2)+date.substr(14,2); return dt; }

and now combined date+time fields can be sorted the right way :D

Somewhere over the drain flows…
Last edit: 15 years 4 months ago by collacocca.

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago #10355 by Vogglz
Beautiful tip for sorting the category tables, thanks!

But, the initial problem this poster has with not being able to search field other than the Title field is still not solved...

There seem to be more user having this issue, and I have posted the problem again here: www.flexicontent.org/forum/index.php?f=20&t=2263&rb_v=viewtopic

Please please please developers, have a look at this. It is a basic feature that should be working, but with some of your users, it simply isn't...

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago - 15 years 4 months ago #10401 by collacocca
Ok another q&d solution -

copy the following javascript function into the 'category_items.php' of your flexicontent template (around line #32) -
Code:
function filter_table( phrase, _id ) { var words = phrase.value.toLowerCase().split(" "); var table = document.getElementById(_id); var ele; for (var r = 1; r < table.rows.length; r++){ ele = table.rows[r].innerHTML.replace(/<[^>]+>/g,""); var displayStyle = 'none'; for (var i = 0; i < words.length; i++) { if (ele.toLowerCase().indexOf(words[i])>=0) { displayStyle = ''; } else { displayStyle = 'none'; break; } } table.rows[r].style.display = displayStyle; } }

change the <div class="fc_fleft"> - block to
Code:
<div class="fc_fleft"> <input name="filter" id="filtr" onkeyup="filter_table(this, 'flexitable', 1)" type="text"> <!--// <input type="text" name="filter" id="filter" value="<?php echo $this->lists['filter'];?>" class="text_area" onchange="document.getElementById('adminForm').submit();" />--> <!--// <button onclick="document.getElementById('adminForm').submit();"><?php echo JText::_( 'FLEXI_GO' ); ?></button>--> <!--// <button onclick="document.getElementById('filter').value='';document.getElementById('adminForm').submit();"><?php echo JText::_( 'FLEXI_RESET' ); ?></button>--> <label for="filtr">Search</label> </div>
(we keep the original code because you never know)
et voilà - you can even use more than one keyword (AND)

And don't forget to activate the search field in your category params

The javascript is from www.vonloesch.de/node/23
Give him the credits, the honour and your recognition. Me the money 'nd love :D
And here is an extension leparlement.org/filterTable
Someone out there who brings in the 'string OR string' function?

Somewhere over the drain flows…
Last edit: 15 years 4 months ago by collacocca.

Please Log in or Create an account to join the conversation.

More
15 years 4 months ago #10469 by Vogglz
Wow collacocca,

this is not a q&d solution, it is magnificent in all its simplicity! :mrgreen:

Even better than what I asked for, this should be in Flexicontent core! Thanks a million! :D

By the way, there is 1 too many brackets ( } ) at the end, wouldn't work at first.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save