With following imports, I have my datatable functioning:
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css"
href="<c:url value="css/jquery.themeroller.css" />" />
<!-- TableTools CSS -->
<link rel="stylesheet" type="text/css"
href="<c:url value="css/TableTools_JUI.css" />" />
<!-- jQuery -->
<script type="text/javascript" charset="utf8"
src="jQuery/jquery-1.8.2.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8"
src="jQuery/jquery.dataTables.min.js"></script>
<!-- TableTools -->
<script type="text/javascript" charset="utf8"
src="jQuery/TableTools.js"></script>
<script type="text/javascript" charset="utf8"
src="jQuery/ZeroClipboard.js"></script>
I am now trying to have tabletools options (print, save, copy, xls buttons) for my table.
I have inserted
oTable = $('#myTable').dataTable({
"bJQueryUI" : true,
"iDisplayLength" : 10,
"sPaginationType" : "full_numbers",
"aaSorting" : [ [ 7, "desc" ] ],
"sDom": '<"H"lfr>t<"F"ip>' )}
but there is no change.
Do I have to change any of import queries or add css or something to get tabletools working?
I have tried "sDom":
"sDom": '<"H"lfr>t<"F"ip>'
"sDom": '<"H"lfrT>t<"F"ip>',
"sDom": '<"H"lfr>t<"F"ip>T',
I had this for sSwfPath:
"C:/JAVA ENVIRONMENT/Workspace/Test/DisplayTable3/DataTables-1.9.4/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf"
still nothing
Thanks in advance
Change "C:/JAVA ENVIRONMENT/Workspace/Test/DisplayTable3/DataTables-1.9.4/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf"
to a web path on your webserver. It's a common problem related to swf security. Found it on DataTables website. Also you can't redeclare sDom.
This is my working code with TableTools and ColVis:
$(document).ready( function () {
$('#results').dataTable( {
"sDom": 'T<"clear">Clfrtip',
"oTableTools": {
"sSwfPath": "http://192.168.78.7/cdtc/app/custom/libs/DataTables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
Related
I'm using Kendo DataBound event to print the model from the row triggering the event, the problem I'm facing is the model is undefined when using DataBound different from using Edit event.
.Events(e => { e.DataBound(#<text>function(e) { alert(e.model); }</text>) })
The problem is that apparently e.DataBound is not handling the e argument as the Edit, Cancel, and the rest of events.
When trying with e.Edit(#<text>function(e) { alert(e.model); }</text>) the e.model object is loaded with the properties and values.
Is there a way to achieve this?
You can achieve that by using jQuery only:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.mobile.all.min.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/kendo.all.min.js"></script>
<script>
$(function() {
$('#grid').kendoGrid({
dataSource: {
data: [{ A: 1, B: 2 }, { A: 3, B: 4 }]
},
});
let grid = $("#grid").data("kendoGrid");
$("#grid").on('click', 'tbody td', function(e) {
let $td = $(e.target),
dataItem = grid.dataItem($td.parent()),
cellContent = dataItem[$td.data('field')];
console.log($td, dataItem, cellContent);
});
});
</script>
</head>
<body>
<div id="grid"></div>
</body>
</html>
Demo
Or by using the grid's change event. But in order to use that event you need to set your grid selectable to true:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.mobile.all.min.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.1.114/js/kendo.all.min.js"></script>
<script>
$(function() {
$('#grid').kendoGrid({
dataSource: {
data: [{ A: 1, B: 2 }, { A: 3, B: 4 }]
},
selectable: true,
change: function() {
let dataItem = this.dataItem(this.select());
console.log(dataItem);
}
});
});
</script>
</head>
<body>
<div id="grid"></div>
</body>
</html>
Demo
I'm creating a mobile app using KendoUI in the Telerik AppBuilder. I created a blank view to hold my chart and then went in to start adding the code. I cannot get the chart to appear.
These are the scripts referenced in my index.html:
<script src="cordova.js"></script>
<script src="kendo/js/jquery.min.js"></script>
<script src="kendo/js/kendo.mobile.min.js"></script>
<script src="app.js"></script>
<script src="lib/progress/progress.all.min.js"></script>
<script src="dataProviders/progressDataProvider.js"></script>
Here is the code of my chart view:
<div data-role="view" data-title="Audit Tracker" data-layout="main" data- model="app.auditTracker" data-show="app.auditTracker.onShow" data-after-show="app.auditTracker.afterShow">
<div id="chart">
</div>
</div>
And here is the code in the associated JavaScript file:
'use strict';
app.auditTracker = kendo.observable({
onShow: function () {},
afterShow: function () {}
});
(function(parent) {
$("#chart").kendoChart({
title: {
text: "Audit Tracker"
},
series: [
{name: "Audits Completed", data: [5,10,15,3]}
],
categoryAxis: {
categories: ["January", "February", "March", "April"]
}
});
})(app.auditTracker);
What am I doing wrong here? This seems like it should be simple!
Thanks in advance for the help.
My problem was that I did not have the correct framework files referenced in my index.html.
Here are the files that I ended up using as far as the framework goes:
<script src="cordova.js"></script>
<script src="jquery.min.js"></script>
<script src="kendo.all.min.js"></script>
<link rel="stylesheet" href="kendo.common.min.css" />
<link rel="stylesheet" href="kendo.default.min.css" />
<link rel="stylesheet" href="kendo.mobile.all.min.css"/>
I am attempting to dynamically load a page of product info, that has an accordion menu for the user to browse. I bring in the content for the accordion dynamically using AJAX after a button click. The HTML for the accordion is showing up in the manner that it should, but the accordion "method" isn't being executed to modify the content into an accordion.
Imports:
<link rel="stylesheet" href="css/supersized.css" type="text/css" media="screen" />
<link rel="stylesheet" href="theme/supersized.shutter.css" type="text/css" media"screen" />
<link rel="stylesheet" href="css/NewSite.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/resources/demos/style.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery.easing.min.js"></script>
<script type="text/javascript" src="/development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="/development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="/development-bundle/ui/jquery.ui.accordion.js"></script>
<script type="text/javascript" src="js/supersized.3.2.7.min.js"></script>
<script type="text/javascript" src="theme/supersized.shutter.min.js"></script>
<script type="text/javascript" src="js/jquery.ModalWindow.js"></script>
Accordion Call in the JQuery:
<script type="text/javascript">
jQuery(document).on('click', '.subMenuItem', function()
{
event.preventDefault();
var subMenuItemID = '#' + $(this).attr('id');
var menuItemContent = $('#MenuItemContent');
var mainCategory = $(this).attr('id').split('xx')[0];
var subCategory = $(this).attr('id').split('xx')[1];
$.ajax({
url: '/php/SubMenuItemContent.php',
data: {
MainCategory: mainCategory,
SubCategory: subCategory
},
success: function(result) {
menuItemContent.html(result);
}
});
$('.accordion').accordion({
heightStyle: "content",
active: false,
collapsible: true
});
}
});
</script>
The resultant Markup from the AJAX is correct, but the accordion doesnt display properly, it displays as a normal block of H3's and divs.
Two things, first you have an extra } at the end of your script.
Second, the accordion content isn't loaded correctly because the accordion DOM elements are not yet loaded (they are loaded in your AJAX call), so put the following your SubMenuItemContent.php file:
<script>
jQuery(document).ready(function($) {
$('.accordion').accordion({
heightStyle: "content",
active: false,
collapsible: true
});
})
</script>
to init the accordion that is loaded.
Alternatively you could try moving the accordion() call inside your success callback like so:
success: function(result) {
menuItemContent.html(result);
$('.accordion').accordion({
heightStyle: "content",
active: false,
collapsible: true
});
}
But I've had more success with the previous method, for whatever reason.
I am unable to get Fancybox to load videos into the lightbox when I upload it to a server. It works perfectly when I test it locally. I have done what I believe is a vanilla install of it and it still doesn't work. I have tried using different hosts and both Firefox and Safari.
Here is an install http://zentube.tv/test2.html.
And here is my code:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<!-- jQuery library -->
<script type="text/javascript" src="includes/jquery-1.6.1.min.js"></script>
</script>
<!-- fancybox -->
<link href="includes/fancyBox2/source/helpers/jquery.fancybox-thumbs.css" media="screen" rel="stylesheet" type="text/css">
<link href="includes/fancyBox2/source/jquery.fancybox.css" media="screen" rel="stylesheet" type="text/css"></link>
<link href="includes/fancyBox2/source/helpers/jquery.fancybox-buttons.css" media="screen" rel="stylesheet" type="text/css"></link>
<script type="text/javascript" src="includes/fancyBox2/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="includes/fancyBox2/source/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="includes/fancyBox2/source/helpers/jquery.fancybox-buttons.js"></script>
<script type="text/javascript" src="includes/fancyBox2/source/helpers/jquery.fancybox-media.js"></script>
<!--**Quicktime not supported in Fancybox when using Internet Explorer-->
<script type="text/javascript">
<!-- to play quicktime MUST HAVE class="fancybox-qt" -->
$(".fancybox-qt").fancybox({
width : 640,
height : 340,
beforeLoad : function() {
var href = this.href,
width = this.width,
height = this.height;
// Check if quictime movie and change content
if (href.indexOf('.mov') != -1) {
this.content = '<object width="' + width + '" height="'+ height + '" pluginspage="http://www.apple.com/quicktime/download" data="'+ href + '" type="video/quicktime"><param name="autoplay" value="true"><param name="scale" value="tofit"><param name="controller" value="true"><param name="enablejavascript" value="true"><param name="src" value="' + href + '"><param name="loop" value="false"></object>';
this.type = 'html';
}
}
});
</script>
<!-- to play media MUST HAVE class="various fancybox.iframe" -->
<script type="text/javascript">
$(document).ready(function() {
$(".various").fancybox({
maxWidth : 800,
maxHeight : 600,
width : '90%',
height : '90%',
openEffect : 'fade',
closeEffect : 'fade'
});
});
</script>
</head>
<body>
<!--example of relative URL quicktime video -->
<a class="fancybox-qt" title="Suwappu" href="video/birds_eye.mov" ><img src="video/cycling_large.jpg" width="200" height="115"></a>
</body>
</html>
I have looked at quite a few similar questions on Stackoverflow, but none seem to have the same problem as this.
Any help would be appreciated.
I got to the bottom of it - a corrupt js file that seemed to only cause problems on the server. Replacing everything with fresh files fixed the problem.
Im trying to use ScrollTo and Lightbox2 on the same page but the Lightbox2 JS links knock out the ScrollTo JS files.
This is what I have:
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<link href="css/lightbox.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://flesler-plugins.googlecode.com/files/jquery.localscroll-1.2.7-min.js"></script>
<script type="text/javascript" src="http://flesler-plugins.googlecode.com/files/jquery.scrollTo-1.4.2-min.js"></script>
<script type="text/javascript" src="js/transition.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#links').localScroll({
target:'body'
});
});
<script type="text/javascript" src="js/transition.js"></script>
Where am I going wrong?
Hope someone can help!
Kind Regards
Matt
<script type="text/javascript"> $(document).ready(function() {
$('#links').localScroll({
target:'body'
});
});
I think you have a typo? You need to end this script with </script>