[ 2 posts ]

Andreas H

  • Username: derdres
  • Joined: Wed Dec 07, 2011 3:59 am
  • Posts: 1
  • GitHub: derdres
  • Gists: derdres
  • Offline
  • Profile

Initialize QB with values - how

Post Posted: Wed Dec 07, 2011 4:54 am
+0-
Hi all

John, thank you for this great plugin!

As a complete YUI3 newbie I seem to struggle a bit - and I think what Im trying to achieve is dead simple :| How can I initialize the QB with specific query values?

Assuming I have the var_list and ops from this example http://jafl.github.com/yui3-gallery/querybuilder/. How can I initialize the QB with these values:

Query row 0 : Url, is , "http://jafl.github.com/yui3-gallery/yuidoc/QueryBuilder.html"
Query row 1: Click-through rate (%), < Less than, 20

Such that the QB looks like this a initial load:
Image

John Lindal

YUI Contributor

  • Username: jafl
  • Joined: Mon Nov 02, 2009 2:33 pm
  • Posts: 352
  • Location: Los Angeles, CA
  • Twitter: jafl5272
  • GitHub: jafl
  • Gists: jafl
  • Offline
  • Profile

Re: Initialize QB with values - how

Post Posted: Mon Dec 12, 2011 8:15 am
+0-
Sorry for not finding this post sooner!

After creating the widget, call appendNew(name, value), where name is the name of the variable, and value depends on the plugin type. I have updated the API docs to explain this more clearly.

In your case, to get the screenshot:

query.appendNew('ctr', [ 'equal', 20 ]);
query.appendNew('url', [ 'equal', 'http://jafl.github.com/yui3-gallery/yuidoc/QueryBuilder.html' ]);
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum