0

I've been experimenting with RedQueryBuilder to build a query interface for searching a table of users.

I've defined an enumerate(request, callback) function and successfully populated dropdown lists of options for the user to choose from (e.g. titles: Mr, Ms, Mrs, etc.). I can save the generated query and args list to a database. Later, I can get the query interface to rebuild itself using the previously stored sql and args.

However, when parsing existing sql and args, the selections from the dropdown editors are not preserved (whereas string values are).

Is there anyway to override the onLoad() function to set the correct dropdown option for existing sql and args?

hopper
  • 13,060
  • 7
  • 49
  • 53
Martyn W
  • 188
  • 1
  • 6
  • That just sounds like a bug. Might be worth trying the 0.5.0 beta http://0-5-0.redquerybuilder.appspot.com/ – salk31 Aug 15 '13 at 06:26
  • Thanks salk31: unfortunately I've just tried the 0.5.0 beta but the same problem remains. It does correctly initialise non-dropdown input using the values specified in the args[]; however select-dropdown inputs remain unselected. Is there any event I can bind to instead and set the dropdown selected item? – Martyn W Aug 15 '13 at 14:30
  • Well I can reproduce so should be able to get a fix soonish. Are you doing the enumerate sync or async? Is the sort of event you are after something like "add drawn and populated"? At the moment it doesn't keep track of outstanding enumerate requests etc. – salk31 Aug 15 '13 at 15:26
  • In my tests I've been populating enumerates via asynchronous ajax calls; but I could just as easily initialise the selects (and their options) in the metadata config on startup if that were possible. Ideally, I'd like an event where I can say input[1].selectedValue=args[1]; input[2].selectedValue=args[2]; etc... You must already have a similar event/method to set textboxes to values in the args array - if this exists, perhaps it could call a user-defined function, e.g. CustomSetValue(input, arg){} which I could override to do some custom setting? Thanks anyway for your time looking into this. – Martyn W Aug 15 '13 at 15:45
  • Doh. It is because the callback is async. Pretty dumb bug but should work if you make the call sync. Internally no real event when loading SQL and args. The args get stashed then as the tree is constructed the nodes that match each ? pickup a value. Do you still have a need for this event if the bug is fixed? 0.5.0 adds more control over style names added to DOM nodes. An event to take more use of them would probably make sense postRedraw event maybe. – salk31 Aug 15 '13 at 17:07
  • I've updated 0.5.0 beta, should work with async callbacks now. – salk31 Aug 16 '13 at 05:26
  • Brilliant, the 0.5.0 beta is working exactly as expected – Martyn W Sep 02 '13 at 16:24

1 Answers1

0

Sadly 0.4.0 does not support async call backs for this particular control (terribly confusing name of SELECT). Might be fixed in 0.5.0.

salk31
  • 995
  • 2
  • 8
  • 13