Plugin does not display setup!
Plugin does not display setup!
Hi, I'm trying out a plugin for the editor, now with just a simple javascript file for a simple field type so when clicking it changes a color as you can see there are no examples that are in this link jscolor.com/examples/, but it seems simple to present it in a field, not editor I can not see it. Where am I going wrong, and what's wrong with my plugin? For both color visualization by javascript and an update coming table, I can not get either!
////////// Plugin Color
(function ($, DataTable) {
if ( ! DataTable.ext.editorFields ) {
DataTable.ext.editorFields = {};
}
var Editor = DataTable.Editor;
DataTable.ext.editorFields.color = {
create: function ( conf ) {
var that = this;
conf._input = $(
'<div class="input-group" id="' + conf.id + '">' +
'<input id="receitaCor" class="jscolor form-control" value="#F00" />' +
'</div>'
);
return conf._input;
},
get: function ( conf ) {
return conf._input.children('input').val();
},
set: function ( conf, val ) {
console.log(conf._input.val( val ));
console.log("val1 ### " + $('input', conf._input).val());
var color = $('input', conf._input).val();
$('input', conf._input).val(color);
},
enable: function ( conf ) {},
disable: function ( conf ) {}
};
})(jQuery, jQuery.fn.dataTable);
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
on the link is a stripe of the color field for demonstration ec2-54-86-12-163.compute-1.amazonaws.com:8080/financeiro/receitas
the image shows the color field:
You'll need to initialise the colour picker plug-in. Their demos rely upon the
input
already being in the document when the script is loaded. That isn't the case here since theinput
is added after the script it loaded.I scanned over their site to find some API documentation, but didn't see any. You'll need to ask them how to initialise their plug-in on a dynamically added element.
Allan
Hello Allan, I did not quite understand what I meant about dynamically initializing the plugin. I checked the site of this plugin I am using and basically it is just a file (here - localhost:8080/financeiro/global/vendor/ascolor/jscolor.js) that is available for use, and I started it before the body of the page and apparently everything is ok! How should it be done exactly for this feature to work perfectly?
in the image you can check the operation inside page, noting the loading of the file responsible for the color plugin!
What can I do about it?
You would need to ask the author of that plug-in. The question to ask them is: "How do I initialise your software on an
input
element which has been dynamically added to the page.I don't the answer to that since I didn't write that software, nor do I support it under either free support or the paid support.
Allan
How Does Paid Support Lenders Work? I do not understand how the credits are spent when they are bought! Are expenses per question? How can each credit be spent?
Credits are used at the rate of:
edit To explain further - If it took me 2 minutes to answer a question, only 2 credits would be charged. If a more complex question were asked and it took 30 minutes to answer, 30 would be charged - etc.
However, as I say, I cannot support third party software.
Allan