I've Googled and seems nothing in particular that answers my question. I saw this though https://datatables.yajrabox.com/ but since Datatable is front-end component and my requirement is that Datatable will only be populated from Ajax request when a button is clicked, I want to include the npm package of the Datatable to the build output of the npm run dev so that i can use the $('#table').Datatable() elsewhere. Can anyone help me please? I'm not so expert with front-end development.
I already tried adding
var $ = require( 'jquery' );
var dt = require( 'datatables.net' )();
var buttons = require( 'datatables.net-buttons' )();
or with arguments as the their manual says
var $ = require( 'jquery' );
var dt = require( 'datatables.net' )( window, $ );
var buttons = require( 'datatables.net-buttons' )( window, $ );
I'm only getting this error
$(...).DataTable is not a function
I even tried downgrading datatables.net version to 1.10.9 as what Downgrade datatables.net version said, but still no luck .
Thanks,
Related
Ok I had a developer I hired a while back to add some features into my app, at time I had never even looked into Vue or how it works. So when he only updated my app.js and not the repos vue files. Thus a year later when we decide to add new features yet again the old ones go * poof * when compiling the bundle. I have rebuilt most of it but ran into this part where it is importing a file that has no extension.
var _underscore = require('underscore');
var _underscore2 = _interopRequireDefault(_underscore);
var _Conversation = require('./Conversation.vue');
var _Conversation2 = _interopRequireDefault(_Conversation);
var _conversation = require('./../../api/conversation');
var _conversation2 = _interopRequireDefault(_conversation);
var _sweetalert = require('sweetalert');
var _sweetalert2 = _interopRequireDefault(_sweetalert);
This part here where it has /api/conversation - now you can see this with underscore and sweet alert.. but very confused about this one.. I dug into the app.js to find the reference for this and it was.
[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _vue = require('vue');
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
removeConversation: function removeConversation(website_id, conversation_id) {
return _vue2.default.http.post('/api/chat/' + website_id + '/' + conversation_id + '/remove');
}
};
},{"vue":41}]
So I rebuilt the file in the location it points to the best of my knowledge and and just leave it with no extension and if i leave in an import for vue it then says it has to be a module for import. so if i leave the vue part off it will build but then it doesn't see to do what is intended. If add .vue on the end it adds a lot of extra code on the build and still doesnt' do what is intended. I am think maybe is file has an extension but I just am not familiar enough with Vue to know it. Hoping someone can shine some like on this issue.
ok seems that the app.js can read a .js file without having the extension on the end. so this is the file type that I was missing.
I'm trying to implement Fresco in my NS Vue app.
I have this in my main.js
Vue.registerElement('FrescoDrawee', () => require("nativescript-fresco").FrescoDrawee)
var application = require("application");
var fresco = require("nativescript-fresco");
if (application.android) {
application.onLaunch = function (intent) {
fresco.initialize();
};
}
and in home.vue
< FrescoDrawee horizontalAlignment="stretch" height="150" :imageUri="item.avatar" />
this is the error I'm getting. "SimpleDraweeView was not initialized!". I'm pretty sure the way I'm initializing it is wrong. Googling it gives me examples in TS and Angular, and none for nativescript Vue. any help would be greatly appreciated
Mostly TypeScript is again JavaScript if you eliminate the typings from code. It's just the same you will have to follow in irrespective of your flavour (Core / Angular / Vue).
if (application.android) {
application.on("launch", function () {
fresco.initialize();
});
}
Source: https://github.com/NativeScript/nativescript-fresco#how-to-use-nativescript-fresco
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
my ckeditor version : 4.3.5
it's very difficult customizing.
i want to cutumize [image info] just like (1) style.
URL input include Upload file select.
remove send to server button.
or.. (2) style :: just remove tab[image info] and [send server button]
but i can't search these info. T^T plz help me.
i want to import image for my question describe. but i need 10 repution;
my question images link.
[image] : https://lh5.googleusercontent.com/-fDpngTmZ9uw/U3mmOZiNA3I/AAAAAAAAABE/_Zoom5BOCJk/w958-h671-no/qna.png
soled
CKEDITOR.on( 'dialogDefinition', function( ev ) {
var dialogName = ev.data.name;
var def = ev.data.definition;
if ( dialogName == 'image2' ) {
def.removeContents('info'); // info tab remove
def.getContents('upload').remove('uploadSubmit');
}
});
CKEDITOR.replace( 'editor1' ,
{
toolbar: 'Full',
filebrowserImageUploadUrl: '/editor/imgsave.do' // import img to server (java)
}
);
Use dialogDefinition event. See these answers (first, second) and the official how-to to know more.
Use this code instead
config.removeDialogTabs = 'image:info;image:Link;image:advanced';
I'm trying to use Firefox Add-on SDK with js-ctypes to access the methods of a local DLL, but it isn't working.
The main.js code:
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "mysite.com",
contentScriptFile: data.url("myjs.js")
});
The myjs.js code is just:
Components.utils.import("resource://gre/modules/ctypes.jsm");
alert("hello world");
On Firefox's console I got those messages:
The Components object is deprecated. It will soon be removed.
TypeError: Components.utils is undefined
No "hello world" alert is fired.
What's the problem? Thanks!
You cannot use js-ctypes from a content script - content scripts have no privileges. You have to do that in the extension itself, via chrome authority:
var {Cu} = require("chrome");
var {ctypes} = Cu.import("resource://gre/modules/ctypes.jsm", null);
var lib = ctypes.open(...);
This isn't a ctypes issue.
You can't alert from that context. alert is a method on window. So you can do one of two things:
Get the most recent window and run alert there.
Components.utils.import('resource://gre/modules/Services.jsm');
Services.wm.getMostRecentWindow(null).alert('hello world');
Use prompts service: example at mdn
Components.utils.import('resource://gre/modules/Services.jsm');
Services.prompts.alert(null, 'Hello World TITLE', 'hello world message');
Also if you are using addon sdk you dont have access to Components so you can't do Components.utils.import you will have to put at top of your main.js this const {Cu} = require('chrome'); then you can do Cu.import('blah')