How can we set Maximum date in Ionic - datepicker

I am working on ionic app. i installed a componenet ionic-calendar-date-picker. its working fine. Now i have two problems first one is that i want to show dates maximum till 31/December/2018 and other thing is that i have to put back button on that calender. I dont know how to do kindly let me know about this. Or if you have any other component in mind then it would also be helpful. Thanks in advance. My ionic code is as follow
<ionic-calendar-date-picker
[toDate]="calendarMaximum"
[fromDate]="calendarStart"
[dayLabelsStyle]=" { 'font-weight': 500, 'font-size': '0.7em' }"
[itemSelectedStyle]="{'background': '#D31B63', 'color': '#FDBD10', 'border-radius': '25px'}"
[todaysItemStyle]="{'color':'#D31B63'}"
(onSelect)="dateClicked($event)"></ionic-calendar-date-picker>
and .ts code is as
this.calendarMaximum = moment().subtract(1, 'year').toDate();
this.calendarStart = moment().subtract(5, 'year').toDate();
this.getResults(this.dateSelected, true, true);
```[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/VSnqG.jpg

Related

custom styling broken after upded to v4

After update from v3 to v4.8.3 do not work customizing components. My goal is to override Select component to get text color 'red'.
const styles = theme => ({ temp: { fontSize: 12, color: "red" })
...
<Select classes={{ root: classes.temp }} ....> ...</Select>
but MuiInputBase-input class always stay on top.
https://i.imgur.com/JGK7J89.png
I see that there are diffrents in styles loading by html head import, my current version(v4) is:
https://i.imgur.com/gAlECET.png
I see that import is doubled, and overrides my custom style.
On v3 all mui styles imports was placed on top of list and not mixed vs custom styles. I cant find more info to get solution and reason of doubling imports. where error may arise?
edit:
i must give some more details...
Problem appered after a big legacy project was updated. For represet my problem, i cut most of code and create demo on codesandbox .
Unfortunately it work fine on codesandbox, and dont let see a problem. if i download zip and start it - i have my problem. Tried on two machine ubuntu 18.04 and MacOS, both have that problem - colour red dont applied to second select. Some more detail are in issue if it will helpfull for someone. Reason in solution below
I have created sandbox for you where you can see the overwritten menu items.
Code sandbox: https://codesandbox.io/s/override-select-component-material-ui-c1io6?fontsize=14&hidenavigation=1&theme=dark
The reason was that nested component has wrong import statement. Wrong import that was work "properly" in v3 for some reason:
import InputBase from "#material-ui/core/InputBase/InputBase";
must be:
import InputBase from "#material-ui/core/InputBase";
becouse it, my styles was overriding by base style

Chart js with problems when using too many series

I am using angular chart in one application which basically makes use of chart js. The version of chart js I am using at the moment is the 2.4.0, with angular chart version 1.1.1 (the current lastest one).
So, when I insert few series (for example 4) everything works fine. The problem is when I have cases that handle with 10 series at a time. The event of clicking the serie in order to hide it block somehow and this error is displayed in console:
Uncaught TypeError: Cannot read property 'clearRect' of null
at Object.helpers.clear (Chart.js:5880)
at Chart.Controller.clear (Chart.js:4072)
at Chart.Controller.draw (Chart.js:4365)
at ChartElement.animation.render (Chart.js:4345)
at Object.startDigest (Chart.js:3672)
at Chart.js:3645
To try to help you I moved to the line the error is occuring in Chart.js file:
// -- Canvas methods
helpers.clear = function(chart) {
chart.ctx.clearRect(0, 0, chart.width, chart.height);
};
Have anyone already got this problem? Does Chart js doesn't handle to many series?
Thanks
This was happening to me when I ran out of colors to use for my series. Once I fixed that the hiding and showing of series worked fine, plus no more errors.

Google Annotation chart: Could it be possible to reverse the Y-axis?

I am working with the project that need Google Annotation Chart to show my data. And I have a problem like below.
My problem:
I would like to show the reverse value on the Y-axis.
What I mean is: the bigger the value is down and vice versa (the smaller the value is up)
I try to test all the option at the support docs but it still did not work
https://developers.google.com/chart/interactive/docs/gallery/annotationchart
Option:
...
vAxis: {direction: -1} // This works on line chart but not annotation chart
...
or somethings like
...
max: -200000, // this won't work and it's just keep the value not minus
min: 200000
...
This is my test code that forked from the docs page
https://jsfiddle.net/lecaoquochung/dsmgL9wj/2/
Could anyone help me to answer my problem? (Could it be possible to reverse the Y-axis now and later?)
Thank you very much
Problem solved. I have updated the testcode chart
Solution: add the chart to the option (get support from Googler)
chart : {vAxis: {direction: -1}},
Memo: Wonder that something updated in the API or just syntax (Because there is no description for chart option on graph docs pages)
Hope this help for anyone meet the same problem.

CarouFredSel Plugin using TouchSwipe with links not working

I'm using the awesome CarouFredSel JQuery carousel plugin which includes features for integrating the JQuery TouchSwipe library for handheld devices as well.
The carousel elements are divs, within the div is an image and text wrapped in an <ahref> tag.
Everything works as it should, but I've noticed that if the carousel element (in this case a div) includes a link, the swipe effect on various mobile devices does not work.
If I remove the link around the image/text, the swiping motion works fine. It's almost as if preventDefault() is working in reverse. If I remove the link around the image, and leave the text as a link, the swiping works for the image, and not the text.
I can easily click the item as a link, I just cannot swipe if it IS a link.
Has anyone experienced this problem with CarouFredsel in particular?
Many thanks, SO.
Touchswipe is disabled by default for a elements.
See http://labs.rampinteractive.co.uk/touchSwipe/demos/Excluded_children.html
From the link:
By default the value of $.fn.swipe.defaults.excludedElements is "button, input, select, textarea, a, .noSwipe, " To replace or clear the list, re set the excludedElements array. To append to it, do the following (dont forget the proceeding comma) ...
excludedElements:$.fn.swipe.defaults.excludedElements+", #some_other_div" });
I ended up just changing the defaults in the plugin, since all my modals were children of an anchor element.
excludedElements:"button, input, select, textarea, .noSwipe"
The carouFredSel with < a > doesn't work for me well with swipe 'inside'.
You can use excludedElements, but on Ipad you'll have to hold your finger to use < a > (longTap). That's not good for users. If you try to use carouFredSel({ swipe:( option { tap: function ... it won't work (at least in my case).
My solution is to use swipe (touchSwipe) separately:
$(".carusel").swipe({
excludedElements: "button, input, select, textarea, .noSwipe",
swipeLeft: function() {
$('.carusel').trigger('next', 4);
},
swipeRight: function() {
$('.carusel').trigger('prev', 4);
},
tap: function(event, target) {
window.open($(target).closest('.carusel-cnt').find('carusel-cnt-link').attr('href'), '_self');
}
});
Well, I'd really love to know if using links within TouchSwipe and the CarouFredSel plugin is possible, but I found a workaround that seems to work.
Hopefully it will help someone.
I ended up using a second touch jquery library, TouchWipe.
When, calling the CarouFredSel plugin, I set the swipe parameter to true:
$('#carousel-slider').carouFredSel({
width: '100%',
prev: '#prev-propslider',
next: '#next-propslider',
swipe: true
});
Then, calling both the TouchSwipe AND Touchwipe libaries (not sure if this matters, but I'm using the regular TouchSwipe swipe:true parameter for another slider without links), I wrote a separate function to call custom events for the TouchWipe plugin:
$('#carousel-slider').touchwipe({
wipeLeft: function() {
$('#carousel-slider').trigger('next', 1);
},
wipeRight: function() {
$('#carousel-slider').trigger('prev', 1);
}
});
Hopefully this helps someone, but I'd really love to know if TouchSwipe and CarouFredSel can work with <a href> tags as I cannot find any live working examples.
Thanks for the solutions with the excludedElements, that fixed my problem as well. Never thought of that.
But you don't have to use the touchwipe Plugin separately, there is "swipe.options" as a configuration option for touchswipe in the caroufredsel plugin.
See the caroufredsel options
There you can use all options of the touchswipe plugin, I think.
You can use below function to enable click after swipe.
`$('.class').swipe({
swipe: function(event, direction, distance, duration, fingerCount) {},
click: function(event, target) {
$(target).click();
},
threshold: 75
});`
https://stackoverflow.com/a/11919170/3223427
Caroufredsel is already integrated and compatible with touchswipe.
Add tochswipe js library
Add the touch events in the caroufresel configuration
JAVASCRIPT RESULT
$(document).ready(function () {
$('#foo2').carouFredSel({
auto: false,
responsive: false,
items: {
visible: 3,
width: 100
},
width: 600,
prev: '#prev2',
next: '#next2',
pagination: "#pager2",
swipe: {
onMouse: true,
onTouch: true
}
});
});
Here is a working demo

Sencha GXT 2.x Spinner Field

I am having a couple of problems with my SpinnerField in GXT 2.0. First it is showing doubles when the user changes 1.0,2.0 I need it to show Ints 1,2,3 etc.
Second, for the life of me I cannot figure out how to add a change listener to it. Like user makes a change it pops up an alert with the value: just for demonstration purposes.
I have looked through the documentation but cannot find the answer.
try adding this to spinner field :
spinner.setFormat(NumberFormat.getFormat("0"));
spinner.addListener(Events.KeyPress, new KeyListener() {...});
spinner.addListener(Events.Change, new Listener<BaseEvent>(){...});
I will add:
maxNumberMsgField = new SpinnerField();
maxNumberMsgField.setFieldLabel(FeedbackAuthoringStrings.MAX_NUM_MSGS_PROV_LABEL);
maxNumberMsgField.setIncrement(1);
maxNumberMsgField.getPropertyEditor().setType(Integer.class); maxNumberMsgField.getPropertyEditor().setFormat(NumberFormat.getDecimalFormat());
maxNumberMsgField.setMinValue(1);
maxNumberMsgField.setMaxValue(20);