SelectBehavior

Mar 29, 2011 at 1:43 PM
Edited Mar 30, 2011 at 7:28 AM

Hi all,

I needed to have a select behavior , to be able to type data in the input field and to get the whole list of data my select was handling when clicking on the arrow. 

Therefore I have added:

selectBehavior: true, // set to false to disallow the select behavior

in the  $.fn.flexbox.defaults, and I have changed the behaviour of the click on the arrow to take that into account :

if ( o.selectBehavior) { o.selectFirstMatch = false; $input.click(arrowClick); } // simulate <select> behavior

instead of 

 if ( !o.allowInput) { o.selectFirstMatch = false; $input.click(arrowClick); } // simulate <select> behavior

The last touch was to modify the way data was retrieve to get everything which turned therefore I changed the flexbox function to discard cache when selectBehavior was needed. here it is:

if ((cached && !arrowOrPagingClicked && o.selectBehavior)|| (cached && !o.selectBehavior))
and 
if (typeof (o.source) === 'object') {
	if ((!o.allowInput || o.selectBehavior) && arrowOrPagingClicked)
		callback(o.source);
	else
		callback(filter(o.source, params));
Hope it helps someone one day, see you, BTW this could be a nice attribute to have for further releases
Mar 31, 2011 at 12:17 PM

Yoannr, this is a good idea.

I may have missed the point, but would you also need to alter the query so that an empty query is always sent to the server when o.selectBehaviour? I.e.

var qry = q;
if (o.selectBehaviour) qry = '';
var params = { q: qry, p: p, s: pageSize, contentType: 'application/json; charset=utf-8' };

Thanks

Apr 1, 2011 at 7:11 AM
Edited Apr 1, 2011 at 7:12 AM

Definitely! I didn't work the example so far, because I was using a definite serie of objects using a static Json "results" for populating the  control.

Sep 25, 2011 at 8:35 PM

This, it seems to me would have been obvious, ( no offense ).  I ran into a similar situation where it makes this beautiful piece of programming null and void.  A true Select Box allows the user to view all of the results at any time. I just wanted to throw my two cents in in hoping that this issue would be worked on because the solution above is not exactly working. I have a platform that is sending and retrieving data, filling the flexboxes with different stuff for which I need the user to be able to see. However, they can't see it until they delete the current selected value "then click the arrow."

 

I did not find another solution.

Sep 26, 2011 at 8:06 AM
Unfortunately, I couldn't go very much further with this attempt which was working in dev on my machine.
Here , you can find my last go. hope it helps you.