Tailwind for DataTable js - datatables

How can I integrate Tailwind with DataTable js? There are two things I wanna do.
Add tooltip which will display the details of td when hovering that td.( The text will be ellipsed)
Responsive Table
The problem is that my table is not overflowed. When I remove the compiled css, it is fine.The overflow is working but when I add it, the overflow of the table is not working.
Html
<table id="example" class="display w-full">
</table>
Javascript
import * as JSZip from 'jszip' ;
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
import 'datatables.net-dt';
import 'datatables.net-buttons-dt';
import 'datatables.net-buttons/js/buttons.colVis.js';
import 'datatables.net-buttons/js/buttons.html5.js';
import 'datatables.net-buttons/js/buttons.print.js';
import 'datatables.net-responsive-dt/css/responsive.dataTables.min.css';
import 'datatables.net-scroller-dt/css/scroller.dataTables.min.css';
import 'datatables/media/css/jquery.dataTables.min.css';
import 'datatables.net-buttons-dt/css/buttons.dataTables.min.css';
import 'datatables.net-fixedcolumns-dt/css/fixedColumns.dataTables.min.css';
import 'datatables.net-fixedcolumns-dt/js/fixedColumns.dataTables';
pdfMake.vfs = pdfFonts.pdfMake.vfs;
window.JSZip = JSZip;
$(document).ready(function () {
$('#example').removeAttr('width').DataTable({
responsive:true,
scrollY:"80vh",
scrollX:"80vw",
scrollCollapse: true,
dom: 'Bfrtip',
buttons: [
'copy', 'excel', 'pdf'
],
columnDefs: [
{
targets:'_all',
render:$.fn.dataTable.render.ellipsis(10)
},
],
data: res.data.data,
columns: col
});
});

Related

Nuxt 3 #imports should be transformed with real imports

I am using Nuxt 3 and I want to import vuetify.
I've successfully imported vuetify and I can use the componetns of vuetify. And everythinh is working fine, but I am getting a warning and don't know how to fix it
I've added vuetify as a plugin.
This is the warning:
[nuxt] #imports should be transformed with real imports. There seems to be something wrong with the imports plugin.
This is my nuxt.config.ts
export default defineNuxtConfig({
css: [
'vuetify/lib/styles/main.sass'
],
build: {
transpile: [
'vuetify'
]
}
})
And my plugins/vuetify.ts
import {defineNuxtPlugin} from "#app";
import {createVuetify} from "vuetify";
import * as components from "vuetify/components";
import * as directives from "vuetify/directives";
export default defineNuxtPlugin((nuxtApp) => {
const vuetify = createVuetify({
components,
directives
})
nuxtApp.vueApp.use(vuetify)
})
From here, it looks like you also need to set the following
const vuetify = createVuetify({
ssr: true,
})

Bpmn.io custom panel properties doesn't show the field

I have tried to use the Bpmn.io modeler plus panel properties in Vue3 and I followed exactly what they have described in this example in Bpmn.io official examples. But it seems doesn't work properly in Vue (I guess Vuejs is the reason), and I don't know why. I can see the custom group but inside it is completely empty.
These are my codes:
main.js
import { createApp } from 'vue'
import App from './App.vue'
import '../node_modules/bpmn-js/dist/assets/bpmn-js.css'
import '../node_modules/bpmn-js/dist/assets/diagram-js.css'
import '../node_modules/bpmn-js/dist/assets/diagram-js.css'
import '../node_modules/bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css'
import '../node_modules/bpmn-js-properties-panel/dist/assets/properties-panel.css'
createApp(App).mount('#app')
App.vue
<template>
<div>
<div id="js-canvas"></div>
<div id="js-properties-panel"></div>
</div>
</template>
<script>
import BpmnModeler from "bpmn-js/lib/Modeler";
import {
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
} from "bpmn-js-properties-panel";
import magicPropertiesProviderModule from "./provider/magic/";
import magicModdleDescriptor from "./descriptors/magic";
export default {
mounted() {
const diagram = `
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:startEvent id="StartEvent_1"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="412.0" y="240.0"/>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
`;
const bpmnModeler = new BpmnModeler({
container: "#js-canvas",
propertiesPanel: {
parent: "#js-properties-panel",
},
additionalModules: [
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
magicPropertiesProviderModule,
],
moddleExtensions: {
magic: magicModdleDescriptor,
},
});
bpmnModeler.importXML(diagram);
},
};
</script>
I solved my problem
I found out that I need to configure your compiler to recognize JSX properly.
That's the solution:
1- Adding "#babel/plugin-transform-react-jsx": "^7.18.6" as a devDependency in package.json
2- Adding plugins config to the babel.config.js
module.exports = {
presets: [
'#vue/cli-plugin-babel/preset'
],
plugins: [
[
'#babel/plugin-transform-react-jsx',
{
throwIfNamespace: false,
runtime: 'automatic',
importSource: '#bpmn-io/properties-panel/preact',
}
]
]
}

Unknown custom element: <ckeditor> - did you register the component correctly?

I'm following the documentation for setting up a custom Vue ckeditor5 build in a Nuxt app. I created a custom build using the online builder (https://ckeditor.com/ckeditor-5/online-builder/), then downloaded it to my project.
Here is my CKEditorNuxt.vue file:
<template>
<div id="app">
<ckeditor :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
</div>
</template>
<script>
import Editor from '../ckeditor5-custom-editor/build/ckeditor.js';
export default {
name: 'CkeditorNuxt',
data() {
return {
editor: Editor,
editorData: '<p>Default text</p>',
editorConfig: {
}
};
}
}
</script>
And inside where I'd like to place my template:
<CkeditorNuxt v-model="subsection.content"></CkeditorNuxt>
My custom build ckeditor.js file:
import ClassicEditor from '#ckeditor/ckeditor5-editor-classic/src/classiceditor.js';
import Autoformat from '#ckeditor/ckeditor5-autoformat/src/autoformat.js';
import Base64UploadAdapter from '#ckeditor/ckeditor5-upload/src/adapters/base64uploadadapter.js';
import BlockQuote from '#ckeditor/ckeditor5-block-quote/src/blockquote.js';
import Bold from '#ckeditor/ckeditor5-basic-styles/src/bold.js';
import CloudServices from '#ckeditor/ckeditor5-cloud-services/src/cloudservices.js';
import Essentials from '#ckeditor/ckeditor5-essentials/src/essentials.js';
import Heading from '#ckeditor/ckeditor5-heading/src/heading.js';
import Image from '#ckeditor/ckeditor5-image/src/image.js';
import ImageCaption from '#ckeditor/ckeditor5-image/src/imagecaption.js';
import ImageStyle from '#ckeditor/ckeditor5-image/src/imagestyle.js';
import ImageToolbar from '#ckeditor/ckeditor5-image/src/imagetoolbar.js';
import ImageUpload from '#ckeditor/ckeditor5-image/src/imageupload.js';
import Indent from '#ckeditor/ckeditor5-indent/src/indent.js';
import Italic from '#ckeditor/ckeditor5-basic-styles/src/italic.js';
import Link from '#ckeditor/ckeditor5-link/src/link.js';
import List from '#ckeditor/ckeditor5-list/src/list.js';
import MediaEmbed from '#ckeditor/ckeditor5-media-embed/src/mediaembed.js';
import Paragraph from '#ckeditor/ckeditor5-paragraph/src/paragraph.js';
import PasteFromOffice from '#ckeditor/ckeditor5-paste-from-office/src/pastefromoffice.js';
import Table from '#ckeditor/ckeditor5-table/src/table.js';
import TableToolbar from '#ckeditor/ckeditor5-table/src/tabletoolbar.js';
import TextTransformation from '#ckeditor/ckeditor5-typing/src/texttransformation.js';
class Editor extends ClassicEditor {}
Editor.builtinPlugins = [
Autoformat,
Base64UploadAdapter,
BlockQuote,
Bold,
CloudServices,
Essentials,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
Indent,
Italic,
Link,
List,
MediaEmbed,
Paragraph,
PasteFromOffice,
Table,
TableToolbar,
TextTransformation
];
// Editor configuration.
Editor.defaultConfig = {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'imageUpload',
'blockQuote',
'insertTable',
'mediaEmbed',
'undo',
'redo'
]
},
language: 'en',
image: {
toolbar: [
'imageTextAlternative',
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
}
};
export default Editor;
When I load the page, I get this error:
Why might this error be occurring? From other similar posts (Vue.js unknown custom element), I believe I should add an item to the components section, e.g.
components: {
ckeditor: Editor.component,
}
as this works when I use the default CKEditor, but not for my custom build. I think this is the source of my error, but I'm not sure what the correct format is. How should I go about fixing this error? Thanks!

Uncaught CKEditorError: ckeditor-duplicated-modules in Vuejs3

I'm trying to install ckeditor. In console getting this error Here is my package.json file. In ckeditor5 module getting same error when I import font plugin.Now I'm trying to install all plugins manually.
<template>
<div id="app">
<ckeditor :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
</div>
<script>
// ⚠️ NOTE: We don't use #ckeditor/ckeditor5-build-classic any more!
// Since we're building CKEditor from source, we use the source version of ClassicEditor.
// import ClassicEditor from '#ckeditor/ckeditor5-editor-classic/src/classiceditor';
import ClassicEditor from '#ckeditor/ckeditor5-editor-classic/src/classiceditor';
import EssentialsPlugin from '#ckeditor/ckeditor5-essentials/src/essentials';
import BoldPlugin from '#ckeditor/ckeditor5-basic-styles/src/bold';
import ItalicPlugin from '#ckeditor/ckeditor5-basic-styles/src/italic';
import LinkPlugin from '#ckeditor/ckeditor5-link/src/link';
import ParagraphPlugin from '#ckeditor/ckeditor5-paragraph/src/paragraph';
export default {
name: 'app',
data() {
return {
editor: ClassicEditor,
editorData: '<p>Content of the editor.</p>',
editorConfig: {
plugins: [
EssentialsPlugin,
BoldPlugin,
ItalicPlugin,
LinkPlugin,
ParagraphPlugin
],
toolbar: {
items: [
'bold',
'italic',
'link',
'undo',
'redo'
]
}
}
};
}
};

How to use my own icons in vue-bootstrap-datetimepicker

I need to change the icons in the datepicker I am using in a vue component.
Here the link: https://www.npmjs.com/package/vue-bootstrap-datetimepicker
In my main.js I have (the relevant parts):
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import 'pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css'
import datePicker from 'vue-bootstrap-datetimepicker'
import '#/icons' // icon
Vue.use(BootstrapVue)
Vue.use(datePicker)
Vue.use(require('vue-moment'))
This import '#/icons' is for my own folder containing the svg code for each icon. It is working fine all over the app.
Following in the code (still main.js):
jquery.extend(true, jquery.fn.datetimepicker.defaults, {
icons: {
time: '<svg-icon icon-class="plus-circle" class="plus" />',
date: 'tools',
up: 'run',
down: 'pdf',
previous: 'tree',
next: 'user',
today: 'form',
clear: 'table',
close: 'eye'
}
})
I've changed the default icons with my own (just with their names -random, as I normally do in the rest of the app, or with the html tag), but it doesn't work.
Also, this part is not really clear to me jquery.fn.datetimepicker.defaults,. Following the imports I should use datePicker, but if I do it, the console says it is not defined.
So I actually don't know for sure if the problem is using my own icons, or if I am doing something wrong somewhere else in the code.
Following the docs, in my vue.config file I've added this code
// plugin date time picker
config
.plugin('provide')
.use(require('webpack').ProvidePlugin, [{
Vue: ['vue/dist/vue.esm.js', 'default'],
$: 'jquery',
moment: 'moment',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}])
inside the chainWebpack(config).
In the vue template where I use the datetimepicker component I have:
<script>
// Import required dependencies
import 'bootstrap/dist/css/bootstrap.css'
// Import this component
import datePicker from 'vue-bootstrap-datetimepicker'
// Import date picker css
import 'pc-bootstrap4-datetimepicker/build/css/bootstrap-datetimepicker.css'
export default {
name: 'NewActivity',
components: {
datePicker
},
data() {
return {
date: null,
options: {
format: 'DD/MM/YYYY HH:mm:ss',
locale: 'it',
useCurrent: false,
showClear: true,
showClose: true
}
}
}
}
</script>
I tried leaving the default ones, using glyphicons, using fontawsome and changing their names according to the last release but I never seen any icon showing.
Hope someone can help.
Thanks a lot.
x