tempusdominus clear minDate/maxDate - tempus-dominus-datetimepicker

I am using tempusdominos jquery plugin and i am trying to use the minDate and maxDate feature to link 2 time pickers. I can set these values, but it seems impossible to clear these values.
I tried :
$('#datetimepicker6').datetimepicker({
minDate: false
});
and
$('#datetimepicker6').datetimepicker({
minDate: null
});
sample

I think you need to do it like this:
$('#datetimepicker6').datetimepicker('minDate', null);

I was struggling with the same issue. Setting false like this worked for me:
$('#datetimepicker6').datetimepicker('minDate', false);

Related

How to resumeOnError (or similar) in RxJS5

I would like to use the onErrorResumeNext feature of RxJS, i.e. to continue to receive events even if an error is received (instead of terminating).
But I can see in the following doc that there is no correspondance in RxJS5: https://github.com/ReactiveX/RxJS/blob/master/MIGRATION.md.
Is there a workaround to use such feature?
Thanks!
I've been looking for that operator too! I came up with a solution for my needs that I hope will help yours. It's not the best solution most likely, but I hope it can help until a better solution can be found by some others on here, or until this operator is added back in 5.0 (hopefully!) :)
var Observable = Rx.Observable;
var source1 = Observable.create(function(observer){
observer.error();
});
var source2 = Observable.create(function(observer){
observer.next('Continuing on');
observer.complete();
});
var stream = source1.catch(function(data){
return source2;
});
stream.subscribe(function(data){
console.log(data);
});
JS Bin Example: https://jsbin.com/qadozoveta/edit?html,js,console
You can use the following in rxjs5 still.
Observable.onErrorResumeNext(observable1$, observable2$, observable3$...)
.subscribe(() => { ... })
onErrorResumeNext source code

ckeditor - Uncaught TypeError: Cannot read property 'icons' of null

When trying to use ckeditor for the first time. ckeditor works, but when I try to add imageupload and uploadloadwidget plugins then I get the error:
Uncaught TypeError: Cannot read property 'icons' of null
Does anyone have any ideas as to what might be causing it?
<script src="//cdn.ckeditor.com/4.5.6/basic/ckeditor.js"></script>
<script>
$(document).ready(function () {
CKEDITOR.plugins.addExternal('imageupload', '/ckeditor/plugins/imageupload/');
CKEDITOR.plugins.addExternal('uploadwidget', '/ckeditor/plugins/uploadwidget/');
CKEDITOR.replace('htmleditor', {
htmlEncodeOutput: true,
extraPlugins: 'imageupload,uploadwidget'
});
});
</script>
Kindly take a look at this http://ckeditor.com/addon/uploadimage and this http://sdk.ckeditor.com/samples/fileupload.html#uploading-dropped-and-pasted-images
for reference.
You'll have to setup the upload url and enable the uploadimage plugin in the configs like this:
config.extraPlugins = 'uploadimage';
config.imageUploadUrl = '/uploader/upload.php?type=Images';
editor.on( 'fileUploadRequest', function( evt ) {
var fileLoader = evt.data.fileLoader,
formData = new FormData(),
xhr = fileLoader.xhr;
xhr.open( 'PUT', fileLoader.uploadUrl, true );
formData.append( 'upload', fileLoader.file, fileLoader.fileName );
fileLoader.xhr.send( formData );
// Prevented the default behavior.
evt.stop();
}, null, null, 4 ); // Listener with a priority 4 will be executed before priority 5.
The docs has more info on this and how to handle different scenarios
Too late for the original poster, but I had this same problem and it turned out that I hadn't included the UploadWidget pluging that UploadImage was dependent on.
Make sure your path has pointed to a valid icon file, is it .ico? or .png? if not set your path to the valid image/icon file. This should solve the problem.
The solution for me was based on #Daniel's response. I started looking for a reference to a plugin that was trying to load but was not installed.
I was not doing any image uploading but I was trying to add a plugin that I had not installed. Specifically, it was:
extraPlugins: 'tableresize',
I did not need tableresize so I just removed the tableresize from the extraPlugins line. I reloaded the page and the error was gone.
Change your PHP Version from 7.4 to 7.3 or bellow

Export an AM Stock chart

Is there a way to enable exporting for a Stockchart? I know it is doable for a normal chart, but for a stock chart, I am getting undefined when try to enable the export mode,
I have tried: chart.export.enabled=true; and chart.amExport.enabled = true; and
var amExport = new AmCharts.AmExport();
amExport.enabled = true;
chart.export=amExport;
but all failed.
Thanks
Try to use the new initialization style of amCharts. See my answer to a question related to this.It seems like the old approach you tried is not working anymore. (At least my few tests were not running)To enable the export use this in the initialization code:
export: {
enabled: true,
position: "bottom-right"
}
And don't forget to include the needed export plugin!
A tutorial can be found here.
Take a look at this fiddle.
Update:
Ok, so this took me a bit, but i found a way, how you can the export feature dynamically. (With JS or JSON initialization)
chart.export = {
enabled: true,
position: "bottom-right"
}
chart.initHC = false;
chart.validateNow();
The key is to set initHC to false, because else it wont load the handler for the plugin. Then just validate again, add some pixie dust and tadaa - it works.
In addition to the above response to include the correct plugins, please ensure you are using html color codes such as "#FF0000" instead of "red" which is supported by earlier am chart export versions if you specify your own colors in the graph (graph.useDataSetColors = false) and valueaxis.
Export works fine whether you use the new JSON or the old style (I am still using the old style new AmCharts.AmStockChart() and $scope.chart.write("chartdiv");

making jQuery plug-in autoNumeric format fields by time page loads

I've been messing around with autoNumeric, a plug-in for jQuery that formats currency fields.
I'd like to wire the plug-in so that all currency fields are formatted by the time the user sees the page, e.g., on load.
Currently, the default that I can't seem to get around is that fields are formatted upon blur, key-up or other action in the fields themselves.
I've been experimenting with the plug-in code and it looks like it will take this relative newcomer some time to resolve this, if at all.
Anybody on this?
Lille
Triggering 'focusout' event formats the field. Triggering 'change' does not work in the most recent version (1.7.4).
$('input.money').autoNumeric({aNeg: '-'}).trigger('focusout');
autoNumeric does all formatting after 'onchange' event fires. So all that you need is to programmatically fire this event. Like this:
$('input.money').autoNumeric({aNeg: '-'}).trigger('change');
Hope this helps!
I just ran into this problem myself. I had to make it more general, but this worked for me:
$('input.auto-numeric').ready(function(){
var format_options = {
aSign: '$'
};
$('input.auto-numeric').each(function(){
$(this).autoNumeric(format_options);
if($(this).attr('id')){
$(this).val($.fn.autoNumeric.Format($(this).attr('id'), $(this).val(), format_options));
}
});
});
This should work.
jQuery(function($) {
$('input.auto').ready(function(){
$('input.auto').autoNumeric();
var inputID = uniqueID; // use the jQuery.get() function to retrieve data
var formatValue = '1234.00'; // use the jQuery.get() function to retrieve data
if(jQuery().autoNumeric){
$('#id').val($.fn.autoNumeric.Format(inputID, formatValue));
}
else{
alert('plugin not available');
}
});
});
Bob
This is what I eventually did:
$(document).ready(function(){
$('input.auto').autoNumeric();
$('input.auto').each(function(){
var element = this
if(element.value !=""){
$('#'+element.id).val($.fn.autoNumeric.Format(element.id, element.value));
}
}
);
});
Another way of forcing formatting is using 'update' like
$(".input-numeric").autoNumeric('update');
In the current version 2.* and onward, this is done by default thanks to the formatOnPageLoad option that is set to true.
It's that simple ;)

Using SortableRows and know when rows have been moved

I want to take advantage of the sortableRows property of the jqGrid. How do I detect when a row has been moved. I have studied the documentation and looked for examples but haven't found much. I do believe it is something like
jQuery("#grid").sortableRows({connectWith:'#gird',
ondrop: function(){ alert("row moved") }});
but that does not work. I can move the rows, but don't seemed to have trapped the event. Is there something wrong with my syntax or my approach in general.
Basically, I need to know that the rows have been rearranged so I can be sure they get saved with their new order.
Thanks
jqGrid uses the ui-sortable plugin to sort rows: http://jqueryui.com/demos/sortable/.
In
jQuery("#grid").sortableRows( options )
"options" is the passed to the sortable plugin.
options = { update : function(e,ui){} }
is what you want.
Attach the sortstop event handler to your grid:
jQuery("#grid").bind('sortstop', function(event, ui) { alert("row moved") });
I did a quick test and that worked for me.
jQuery('#'+grid_id).jqGrid('sortableRows', {
update: function (event, ui) {
var newOrder = $('#'+grid_id).jqGrid("getDataIDs");
//do whatever you want with new roworder
//please keep in mind this will give only page visible rows
}
});

Resources