Is it possible to specify a source for available 'snippets' for the Editor widget. I'd like to put store them in a separate array (or even better, retrieve them from a remote data source).
I've tried something like:
<script type="text/x-kendo-template" id="editor">
<textarea name="test" data-bind="value:test" data-role="editor" data-tools="['insertHtml']" data-insert-html="snippets"></textarea>
</script>
where snippets is the array as per the Editor demo, but this doesn't work.
It this supported?
Maybe no longer relevant, but for further reference:
<textarea data-role="editor"
data-tools="['bold', 'italic', 'underline', 'strikethrough', 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull',
{ name: 'insertHtml',
items: [{ text: 'title', value: '{{title}}' },
{ text: 'description' , value: '{{description}}' },
{ text: 'link' , value: '{{link}}'},
{ text: 'notes' , value: '{{notes}}'}]
}]"
data-bind="value: emailForm.body"></textarea>
This allows you to add snippets to the toolbar using the MVVM method. To get them from a remote datasource you most likely need to do this by finding the kendo control when it is rendered and then set a different datasource with a similar key/value structure.
Related
I use NuxtJs and Vuetify for one project. I need to create a treeview so I would like to do it with v-treeview.
I have a problem with the node name.
Here are my data:
items: [
{
id: 1,
data: {
name: 'Application :',
id: '1',
},
children: [
{},
],
},
}
Here the frontend
<v-treeview :items="items"></v-treeview>
So I would like to have data.name in text but I can't get it. Do you have an idea?
Thanks
Add the item-text property to your v-treeview tag to specify what the value to be displayed is
:item-text="data.name"
you can use the label slot inside your v-treeview like :
<v-treeview :items="items">
<template v-slot:label="{item}">
<div class="v-treeview-node__label">{{item.data.name}}</div>
</template>
</v-treeview>
I've been working on adding a wysiwyg editor, and after messing about a bit I managed to get CKEditor 5 somewhat working with Laravel 6/VueJS. However, no matter what I try to do, I can't seem to be able to add font options to the toolbar. I can either get the editor to render but without font toolbar options, or I can configure the toolbar correctly but the editor doesn't render.
My Blade view includes
<div class="form-group">
<label for="body">Body</label>
<wysiwyg></wysiwyg>
</div>
and I've added the following lines to my resources/app.js file (although the latter doesn't seem to matter much)
Vue.component('wysiwyg', require('./components/Wysiwyg').default);
Vue.use(CKEditor);
My wysiwyg VueJS component is
<template>
<div>
<input type="hidden" name="body" id="body" :value="this.data">
<ckeditor :editor="editor" v-model="data" :config="editorConfig"></ckeditor>
</div>
</template>
<script>
import CKEditor from '#ckeditor/ckeditor5-vue';
import ClassicEditor from '#ckeditor/ckeditor5-build-classic';
export default {
props: ['article'],
components: {
ckeditor: CKEditor.component
},
data() {
return {
data: this.article !== undefined ? this.article.body : '',
editor: ClassicEditor,
editorConfig: {
toolbar: [
'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', '|', 'indent', 'outdent','|', 'blockQuote', 'insertTable', 'undo', 'redo'
]
}
}
}
}
</script>
This does render the editor, but as soon as I add 'fontSize' to the toolbar array, I get an error saying the requested toolbar item is unavailable. I tried adding plugins: [ Font ] to my editorConfig, but then I get an error saying some CKEditor 5 elements are duplicated.
Even following the documentation's approach yields the same "requested toolbar item is unavailable" error;
ClassicEditor.create(document.querySelector('#bodyEditor'), {
fontSize: {
options: [
9,
11,
13,
'default',
17,
19,
21
]
},
toolbar: [
'heading', 'bulletedList', 'numberedList', 'fontSize', 'undo', 'redo'
]
})
.then(editor => console.log(editor))
.catch(error => console.log(error));
I'm honestly lost on how to get it to work, at this point I'm more willing to try out a different wysiwyg editor altogether.
I have a kendo grid with following structure ;
<div id="kendoGrid" data-role="grid" data-bind="source: search" data-scrollable="true" data-auto-bind="false" data-pageable="true" data-columns="[
{ title: '' , width: '100px',locked:true, attributes: { style: 'overflow: visible' } , template: kendo.template($('#tamplate').html())},
{ field: 'name' , title: 'Name Surname' , width: 200},
{ field: 'date' , title: 'Date' , width: 150 },
{ field: 'residence' ,title: 'Residence' , width: 100 },
{ field: 'approveDate' ,title: 'Approve Date' , width: 200 },
</div>
I am also using a template to customize the data in first column. Here is my template;
<script id="tamplate" type="text/x-kendo-tmpl">
<span data-bind="text: nationality, tooltip: nationality"></span>
</script>
The problem is I am using kendo.data.binder and I have some extended methods such as "tooltip" but when I lock the column, it doesnt work The binder method doesnt get fired. Otherwise it works fine. It might seem easy to use #= nationality # format but I have much more complicated extended methods and I need them up and running. Any help would be appreciated.
After a long search, I found out that the version I am using, 2014.1.528 , is not applying data-bind, I dont know why. But when I switch to version 2016.3.1118, it work fine. here is the dojos ;
2016.3.1118 -> here
2014.1.528 -> here
at the moment, we are unable to upgrade to version 2016 so it will remain like this.
I have been trying to build a very simple treemap(no hierarchy) using KendoUI, by providing it some json data as a datasource. This should have been very straightforward and simple as it's a common use-case. However, I am having no luck with it, after spending hours on it.
I tried this :
<body>
<div id="treemap"></div>
<script>
var data = [
{
name: "foo123",
value: 10
},
{
name: "foo234",
value: 20
}
];
$("#treemap").kendoTreeMap({
dataSource: data,
valueField: "value",
textField: "name"
});
</script>
</body>
Any suggestions on what I may be missing?
As stated in the docs "TreeMap is a visualization for hierarchical":
TreeMapping is a visualization for hierarchical data which uses nested
rectangles. Each rectangle's size and color is related to the
structure of the data, allowing you to more easily identify trends and
patterns
So try to add a "root" level that wraps your two elements:
<body>
<div id="treemap"></div>
<script>
var data = [{
name: "foo",
value: 1,
items: [{
name: "foo123",
value: 10
},
{
name: "foo234",
value: 20
}]
}];
$("#treemap").kendoTreeMap({
dataSource: data,
valueField: "value",
textField: "name"
});
</script>
</body>
How, if at all possible, to apply a filter to a Vuetify v-data-table, in conjunction with the 'regular' search property?
Following the Vuetify example (https://vuetifyjs.com/en/components/data-tables)
, consider a Vuetify data-table with two columns:
Dessert
Category
I want to control the table with a search box, linked to the "Dessert" column:
<v-data-table
:headers="headers"
:items="desserts"
:search="search"
></v-data-table>
and:
headers: [
{ text: 'Dessert (100g serving)', value: 'name' },
{ text: 'Category', value: 'category' },
],
But I want to control a filter on the Category column with a group of checkboxes (exact match). There is such a thing as a "custom-filter", but the documentation is not very detailed on that.
This looks to be the same question (unanswered): How to add individual filters for data-table in vuetify?
Turns out it's actually quite simple! The filters are defined in the headers property.
No changes required to the html element:
<v-data-table
:headers="headers"
:items="desserts"
:search="search"
></v-data-table>
The headers are moved to the computed-section and defined like this:
computed: {
headers() {
return [ { text: 'Dessert (100g serving)', value:'name' }
, { text: 'Category', value: 'category', filter: value => {
return this.array_of_matches.indexOf(value) !== -1
},
}
]
}
Where array_of_matches is a variable containing a list of search items. You may optionally want to add case conversion stuff like this: value.toString().toLocaleUpperCase()
The 'regular' search won't match anything on a header that has such a filter defined.