Query Form with More Options

18 views
Skip to first unread message

John Capalbo

unread,
Jan 11, 2013, 6:08:52 PM1/11/13
to sgvi...@googlegroups.com
I am working to customize the sgvizler.html page.  I want to convert the text area, where users enter queries, to have only drop down lists where users select what they want and the backend creates the query based on the user selected options.

Some questions I have in order to do this:

1. Where is the query (from the textarea) getting stored in the javascript when it gets submitted?  I've looked in the submitQuery() function and can't find where it is keeping the user created query.

2. Is there a way to change the endpoint much like you can change the chart options before submitting a query?

Thank you again for all the help.  Sorry for the numerous questions, just really want to take full advantage of this awesome tool!

-John

"Martin G. Skjæveland"

unread,
Jan 12, 2013, 9:28:30 AM1/12/13
to sgvi...@googlegroups.com
On 12/01/13 00:08, John Capalbo wrote:
> I am working to customize the sgvizler.html page. I want to convert the
> text area, where users enter queries, to have only drop down lists where
> users select what they want and the backend creates the query based on
> the user selected options.
>
> Some questions I have in order to do this:
>
> 1. Where is the query (from the textarea) getting stored in the
> javascript when it gets submitted? I've looked in the submitQuery()
> function and can't find where it is keeping the user created query.

In the sgvizler.query object. Here's roughly how it works:

1. submitQuery() copies the contents of the textarea to a hidden text
field in the html form, then it submits the form, i.e., the page is
reloaded.

2. On page load the function go() is executed, which again runs
drawFormQuery() (both found in core.js)

3. drawFormQuery() collects GET parameters sent by the form from the
URL, builds a sgvizler.query object, and runs query.draw().

4. query.draw() (see query.js) does the rest (with some help from
other code parts): adds prefixes to the query, sends the query, receives
the results, parses the results to a google datatable, draws the
datatable with the given chart function.

> 2. Is there a way to change the endpoint much like you can change the
> chart options before submitting a query?

Yes, I have added this functionality in a new branch:

http://sgvizler.googlecode.com/svn/branch/0.5-release/

You can see the diff here:

http://code.google.com/p/sgvizler/source/detail?r=169

> Thank you again for all the help. Sorry for the numerous questions,
> just really want to take full advantage of this awesome tool!

Thanks!
Martin

Reply all
Reply to author
Forward
0 new messages