[ 19 posts ] Go to page 1, 2 Next

Mayank Gupta

YUI Contributor

  • Username: mzgupta
  • Joined: Sun Jul 31, 2011 1:40 pm
  • Posts: 42
  • GitHub: mzgupta
  • Gists: mzgupta
  • Offline
  • Profile

Including Calendar as a value

Post Posted: Thu Feb 09, 2012 12:26 pm
+0-
Hi John,

I am trying to plug calendar in the query builder. The way I am thinking to implement this

First Identify which variable user has selected for that criterion row

If the variable needs calendar then disable the value input box and put icon at the side of this box for popup calendar.

My question is what is the best way to identify what variable user has selected.

If there is other way to implement it please let me know

Mayank

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: Including Calendar as a value

Post Posted: Fri Feb 10, 2012 8:20 am
+0-
I'm trying to find the time to build a date range plugin for Query Builder. (I just need to finish my DateTime gallery module first.) The plugin will still use input fields, to allow the user to type if they prefer that. A calendar will pop up when the input field gets focus.

Your method can work, too, but you need some way to display the selected date when the calendar popup is not visible.

Mayank Gupta

YUI Contributor

  • Username: mzgupta
  • Joined: Sun Jul 31, 2011 1:40 pm
  • Posts: 42
  • GitHub: mzgupta
  • Gists: mzgupta
  • Offline
  • Profile

Re: Including Calendar as a value

Post Posted: Sat Feb 11, 2012 1:01 am
+0-
Hi John,

That's great that you are planning to build date picker for query builder. mean time I came up with following solution
http://ideone.com/Kr454

1) I am extending QueryBuilder and overided appendNew method where I am firing changeSelect event if some one changes the newly appended selected box (which contains all the keys).

2) I am handling that changeSelect event such that if selected keys needs the date picker then I am creating one. After that just syncing between calendar date and value text.


Mayank

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
Tags:

Re: Including Calendar as a value

Post Posted: Sat Feb 11, 2012 10:18 am
+0-
The code in appendNew doesn't account for removing a row from the list of filters. If the user removes a row, count needs to be decremented. Otherwise, selectNode will be null next time the user adds a row.

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: Including Calendar as a value

Post Posted: Sat Feb 11, 2012 10:20 am
+0-
Also, you should really implement the Calendar as a QueryBuilder plugin. You could base it on the QueryBuilder.String class:

http://jafl.github.com/yui3-gallery/yui ... ng.js.html

Mayank Gupta

YUI Contributor

  • Username: mzgupta
  • Joined: Sun Jul 31, 2011 1:40 pm
  • Posts: 42
  • GitHub: mzgupta
  • Gists: mzgupta
  • Offline
  • Profile

Re: Including Calendar as a value

Post Posted: Sun Feb 12, 2012 2:57 am
+0-
Thanks John,

I thought of making it as plugin but was looking for quick workaround.
Anyways I've created it as plugin now http://ideone.com/a9yeT

Now for calendar I've following configuration

Code:
 
       calendar:[
            {
                value: Operators.EQUALS,
                text:'Is'
            },
            {
                value:Operators.BETWEEN,
                text:'Between',
                multipleValue:true
            }
        ]

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: Including Calendar as a value

Post Posted: Sun Feb 12, 2012 9:22 am
+0-
Very nice! My only suggestion is that you switch from 'click' on the input to 'focus'.

Mayank Gupta

YUI Contributor

  • Username: mzgupta
  • Joined: Sun Jul 31, 2011 1:40 pm
  • Posts: 42
  • GitHub: mzgupta
  • Gists: mzgupta
  • Offline
  • Profile
Tags:

Re: Including Calendar as a value

Post Posted: Sun Feb 12, 2012 10:52 am
+0-
Thanks John !

I've changed it to focus event :) ..

Mayank Gupta

YUI Contributor

  • Username: mzgupta
  • Joined: Sun Jul 31, 2011 1:40 pm
  • Posts: 42
  • GitHub: mzgupta
  • Gists: mzgupta
  • Offline
  • Profile

Re: Including Calendar as a value

Post Posted: Mon Feb 13, 2012 5:15 pm
+0-
Hi John,

The only issue now I've that Query builder is created using table now because of calendar BETWEEN operator I have two values for the date variable and other variable has one value that causing unequal number of <td> tags for under <tr> tags and thats causing some formatting issue.

Do you have any idea how to handle this problem ?


Mayank

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: Including Calendar as a value

Post Posted: Mon Feb 13, 2012 5:43 pm
+0-
It should push the + and - buttons further to the right. That is by design. Are there other formatting issues?
  [ 19 posts ] Go to page 1, 2 Next
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