DaterangePicker and second click on same item - javascript

I am using Bootstrap Date Range Picker and I am trying to enable a second click on the same date range.
Ex: User clicks on "today" and gets results, then clicks again 5 minutes after and gets the updated results.
Everything works fine on the first click but due to line 298 .on('click', 'li', $.proxy(this.clickRange, this)) the click gets unbound on that item.
I looked everywhere to try and correct it to no avail.

The callback is only fired when a new date range is selected.
If you'd like to change the behavior, this is the line to change.

Related

Error: setting jQuery FullCalendar properties when the user changes the date

I need to change the minTime property of agendaDay dinamically when the user changes the date. I've tryed this:
dayRender: function(event, element, view) {
$('#calendar').fullCalendar('getView').calendar.options.minTime = '10:35:00';
//$('#calendar').fullCalendar('render');
}
The value '10:35:00' is only an example, because my application brings the real values from database according the selected date. When I uncomment the line $('#calendar').fullCalendar('render'); the page becomes white in consequence of an error, I think.I've tried also $('#calendar').fullCalendar('destroy'); with no results, and the same error appears.
What is the correct manner to refresh the view when the user changes the date?
After initialization is complete, you can only change 'contentHeight','height','aspectRatio',so you must destroy the calendar then rebuild

amCharts Minimal zoom range (minimal period selector range)

I try to use amCharts. I have a chart that represent dayly data. I can't make so user wouldn't be able to choose period less than 5 days (i dont want send 5 days points to chart)
Also i can attach changed event to period selector, but chart zooming and chart scroll bar have no any events and methods i could use.
I need to do so user will see message "please select range that is more than 5 days" when he tries to scroll, select period and zoom chart. And set chart zoom to 5DD.
Also i mentioned that period selector changed event, fire every time when blur event fired on inputs, i think it's not right behavior. It should fire when date changed, yep?
chart.periodSelector.addListener('changed', function(){
alert('changed');
});
I have date picker that attached to period selector inputs (it don't permit user to select less than 5 days range), but i can only update my datepicker ranges only if user input date, i can't to do anything if he zoomed, scrolled chart. I don't see any events in your API for that.
Thanks for your help! Will wait any advice.
Use zoomed event instead.
chart.addListener('zoomed', function (event) {
// Your code
}
And now, to get the selector's start and end date, use this:
event.startDate
event.endDate

jQuery FullCalendar select next day?

Using the jQuery plugin FullCalendar, I want the selected date on the calendar to be incremented(by only one day) on a button click event.
This is the code I have been trying using the incrementDate() method:
$('#coolButton').click(function(){
$('#calendar').fullCalendar('incrementDate', 0, 0, 1);
});
This will only work if I increment the year or the month, but never if I increment the day. Any idea how to get the calendar to select the next day?
Thanks
Actually It does increase the selected date by a given amount of time. (in your example by a single day). The thing is you can't see it.
if you click that button may be 30+ times you can see the calender will move to the next month.
(If you change the CSS of the selected date, then you can see it increment)

jQuery calendar match date from previous input

So what I am trying to accomplish is what most Hotel or Airport sites have in general, after you've chosen a date for your arrival when clicking on the next calendar it automatically updates the calendar dates to the same month in which you chose your arrival.
See: http://hotelsaxchicago.com
I currently have jQuery UI and it's calendar plugin for a casino/hotel site: http://staging.comanchenationcasinos.com
Is there away to do something similar on here? How can I detect what's already in the input field without actually clicking the submit button.
At the same time, how can I trigger the calendar if someone clicks on the icon instead?
Thanks ahead of time.
What I usually do for the calendar link next to the input is something like
$('body').on('click', '.calendar_icon', function(){
$(this).prev('input[type="text"]').focus();
return false;
});
That will drop the focus onto the text input sitting previously in the markup.
Regarding the date resetting, try something like this:
Assuming you have the first input with the id of first_date and the second as second_date...
$('body').on('change', '#first_date', function(){
var this_date = $(this).val();
$('#second_date').datepicker("setDate", new Date(this_date) );
});
Worth noting, you could also attach the two date pickers with data-next-datepicker="#something" to make it really specific if you'd rather not use #second_date. I'd go that route if you had a series of dates on the page.

date picker should appear when clicked on image

In fiddle i am displaying a dynamic date picker which displays date when we put curser on that text box, that is fine.i want a image to be placed right side of text box and when image will be clicked then same date picker will be displayed.
http://jsfiddle.net/cBwEK/
I am trying by putting an image there but when i click on that image nothing happens. How can it be done? Any help please
As it turns out, there is an option for this very thing: toggleElements. It expects a collection of other elements that can also invoke the datepicker. I added an array with a single element and it seems to work just fine.
var dp = new DatePicker('.picker', {
pickerClass: 'datepicker ',
allowEmpty: true,
toggleElements: ['imageInvokerP']
});
Fiddle: http://jsfiddle.net/cBwEK/10/
one ans was given by Jonathan and this should be the way of doing things of these kinds.
but therez an easy solution you can take
assuming id of your image is Image and that of text box is Input
you can do everything normally
binding the datepicker to the input element using $('#Input').datePicker() in document.Ready
next you can bind the click event of the $('#Image') like this
$('#Image').click(function(){
$('#Input').click();
});
this way automatically your input element will get focus when you will click on the image.

Categories