Is it possible to display in some pop up or tooltip image when user make mouse over url that is displayed inside table cell.
I have made it for now like this and this display image inside cell:
{
field: 'image',
title: 'Image',
lockable: false,
template:
'<div class="tooltipcontent">' +
'<img src="' + '#= image #' + '" alt="" />' +
'</div>',
width: '300px'
}
I would do something like this:
<div id="grid"></div>
<script type="text/x-kendo-template" id="template">
<img style="width:100px" src="#=url#">
</script>
</div>
$("#grid").kendoGrid({...});
$("#grid").kendoTooltip({
filter: "td:nth-child(1)", //this filter selects the first column's cells
position: "right",
content: function(e) {
var dataItem = $("#grid").getKendoGrid().dataItem(e.target.closest("tr"));
return kendo.template($("#template").html())(dataItem);
}
}).data("kendoTooltip");
Example: Row template tooltip
Related
I would like to know if it is possible to use datatables (Metronic Laravel Theme) to display a 6*4 grid of user-images instead of displaying the images row-by-row (the standard datatable behavior). Anyone able to help?
ive just started on this so i don't want to waste a lot of time if it's not possible at all, this is what i have so far:
let members_datatable,
members_element = $('...');
members_datatable = members_element.MyCustomDataTable({
columns: [
{
field: 'id',
title: members_element.data('column-id'),
width: 50,
template: function (row) {
return row.id;
}
},
{
field: 'first_name',
title: members_element.data('column-name'),
width: 150,
template: function (row) {
let user_id = ...;
let user_company = ...;
let company_branche = ...;
return `<div class="mt-card-item">
<div class="mt-card-avatar mt-overlay-4">
<img src="storage/public/userImages/${user_id}.jpg">
<div class="mt-overlay">
<h2>${user_company}</h2>
<div class="mt-info font-white">
<div class="mt-card-content">
${company_branche}
</div>
</div>
</div>
</div>
</div>`;
}
},
],
});
In the ckeditor (plugin.js) I have this code below.
CKEDITOR.plugins.add( 'beforeafter', {
requires: 'widget',
icons: 'beforeafter',
init: function( editor ) {
editor.widgets.add( 'beforeafter', {
button: 'beforeafter',
template:
'<div class="ba-slider-element">' +
'<div class="ba-slider">' +
'<div class="resize">' +
'<div class="handle">' +
'</div>',
dialog: 'beforeafterDialog',
upcast: function( element ) {
return element.name == 'div' && element.hasClass( 'ba-slider' );
}
} );
// Define an editor command that opens our dialog window.
editor.addCommand( 'beforeafter', new CKEDITOR.dialogCommand( 'beforeafterDialog' ) );
// Create a toolbar button that executes the above command.
editor.ui.addButton( 'beforeafter', {
// The text part of the button (if available) and the tooltip.
label: 'Insert A Before And After Image',
// The command to execute on click.
command: 'beforeafter',
// The button placement in the toolbar (toolbar group name).
toolbar: 'insert'
});
// Register our dialog file -- this.path is the plugin folder path.
CKEDITOR.dialog.add( 'beforeafterDialog', this.path + 'dialogs/beforeafter.js' );
}
});
In the dialog file (beforeafter.js) I have this code below.
CKEDITOR.dialog.add( 'beforeafterDialog', function( editor ) {
return {
title: 'Before and After Image Tool',
minWidth: 400,
minHeight: 200,
contents: [
{
id: 'tab-basic',
label: 'Basic Settings',
// The tab content.
elements: [
{
type: 'text',
id: 'beforeimage',
label: 'paste your BEFORE image URL below',
validate: CKEDITOR.dialog.validate.notEmpty( "Please add a URL in the Before image field." )
},
{
type: 'text',
id: 'afterimage',
label: 'paste your AFTER image URL below',
validate: CKEDITOR.dialog.validate.notEmpty( "Please add a URL in the After image field." )
}
]
},
],
onOk: function() {
var dialog = this;
var result = editor.document.createElement('div');
result.setHtml("<div class=\"ba-slider-element\">\n" +
"<div class=\"ba-slider\">\n" +
"<img src=\"" + dialog.getValueOf( 'tab-basic', 'beforeimage' ) + "\" alt=\"\">\n" +
"<div overlay-lable=\"Before\" class=\"before-lable-1\">\n" +
"<div overlay-lable=\"Before\" class=\"before-lable-2\">\n" +
"<div class=\"resize\">\n" +
"<img src=\"" + dialog.getValueOf( 'tab-basic', 'afterimage' ) + "\" alt=\"\">\n" +
"<div overlay-lable=\"After\" class=\"after-lable-1\">\n" +
"</div>\n" +
"<div overlay-lable=\"After\" class=\"after-lable-2\"></div></div>\n" +
"<div class=\"handle\">\n" +
"</div>");
editor.insertElement( result );
}
};
});
In the ckeditor posting edit window, when I click the source button to view the source, this is the code that is generated below.
<div>
<div class="ba-slider-element">
<div class="ba-slider">
<img alt="" src="https://pepsized.com/wp-content/uploads/2018/09/beerslider/demo-assets/images/man-hold-beer.jpg">
<div overlay-lable="Before" class="before-lable-1">
<div overlay-lable="Before" class="before-lable-2">
<div class="resize">
<img alt="" src="https://pepsized.com/wp-content/uploads/2018/09/beerslider/demo-assets/images/man-hold-beer-after1logo.jpg">
<div overlay-lable="After" class="after-lable-1">
</div>
<div overlay-lable="After" class="after-lable-2">
</div>
</div>
<div class="handle">
</div>
</div>
</div>
</div>
</div>
The slider works fine but I am not able to edit the URL fields.
When I double click the slider to edit it the dialog window will pop up with an empty URL fields.
ckeditor diolog
What I need help with is.
1. I need the element to highlight in yellow and blue when I hover over the area
2. When I double click to edit, the dialog fields should show the previous inputted URL.
3. How would be able to preview the slider wile in edit mode. the slider use jquery script.
Your help will be truly appreciated.
I created this in fiddle to show what I'm trying to do in nw.js. This works just fine. 2 tabs get created dynamically at run-time just fine.
http://jsfiddle.net/fnbqupf4/
I port this over to my nw.js and I get an error when ace.edit() is called saying it can't find the element ID. When I look at the DOM in nw.js I see the tab and the editor is NOT created there. So the issue is the tab and editor div get created in the jsFiddle but not in the nw.js site.
Is there something with not being able to dynamically add elements to the DOM in nw.js?
$.fn.addEditorTab = function(name, tabName, contents) {
console.log("1");
$('ul', this).append('<li title="' + name + '">' + tabName + '<span class="ui-icon ui-icon-close" role="presentation"></li>');
$(this).append("<div id='tab-" + name + "'><div id='editor-" + name + "' class='editor'></div></div>");
$(this).tabs("refresh");
console.log("2");
var editor = ace.edit("editor-" + name);
console.log("3");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/lua");
editor.setOptions({
maxLines: Infinity
});
editor.getSession().setValue(contents);
return editor;
};
[EDIT]
After some more messing around it seems it's only an issue when I have the tabs div inside a panel in w2ui.
$('#layout').w2layout({
name: 'layout',
panels: [
{ type: 'top', size: 50, style: pstyle, content: 'top', resizable: true },
{ type: 'left', size: 300, style: pstyle, content: '<div id="sidebar" style="height: 100%; width: 100%;"></div>', resizable: true }
//{ type: 'main', style: pstyle, content: '<div id="editor"></div>' }
{ type: 'main', style: pstyle, content: '<div id="tabs"><ul></ul></div>' }
]
});
i have improve my code using highchart. I'm using plotoption to echo variabel just like in http://jsfiddle.net/gF8Cf/3/ .
Here is my highchart code :
plotOptions: {
series:
{
cursor: 'pointer',
point: {
events: {
click: function box() {
var week = this.category;
$("#dialog").dialog({
title: "Detail Data",
buttons: {
Close: function () {
$(this).dialog('close');
}
}
});
},
And for the next, i set the dialog box by :
<div id="dialog" style="display: none">
<div style="margin-left: 35px; font-size:12px;">
IT IS WEEK :
<?php
box();
echo $week
?>
</div>
</div>
I want to show data this.category when the dialog-pop-up-box opened.
The problem is, did i set the wrong code for $week ?
$(function(){
var week = '<?php $week ?>';
});
Try to load the week variable on window load.
How will you display a JQGrid within a dialog?
in html page place table tag which will be used to construct grid inside dialog div like
<div id="dialog-div">
<table id="JqGrid">
</table>
<div id="pager" style="text-align: center; </div>
</div>
then in js first set dialog settings like
$("#dialog-div").dialog({
width: 'auto',
resizable: false,
height: '395',
autoOpen: false,
open: function (event, ui) {
ConstructJqGrid();
},
});
function ConstructJqGrid(){
jQuery("#JqGrid").jqGrid({
...
colModel: [
...
{name:'price', ..., editable:true, edittype:'custom', editoptions:{custom_element: myelem, custom_value:myvalue} },
...
]
...
})
}
This is how I did it, with AJAX to get the page containing my jqGrid :
$.ajax({
[...],
success: function( data ){
var popup = document.createElement( "div" );
// Appending
$( popup ).append( data );
$( "body" ).append( popup );
// Dialoging
$( popup ).dialog({
[...]
});
}
});
PS : I don't know the rules about necroposting but since the answer was never given, I chose to answer it.
If you are using the jquery-ui dialog use this page,the first example will show you how to create a dialog with #dialog. Then this page will have a have a basic JQGrid example which you will embed into your #dialog. If you are using a different type of a dialog, the process should be similar.