creating timeline using vis examples - timeline

i am trying to create a timeline using vis examples..so far i have managed to put the code as below..however if i really see the example on web, it shows me the item bars. when i try to run this example on my computer, the items are missing on the timeline. what am i doing wrong here?console shows me no errors.
code->> <!DOCTYPE HTML>
<html>
<head>
<title>Timeline | Individual editable items</title>
<style>
body, html {
font-family: arial, sans-serif;
font-size: 11pt;
}
div.vis-editable,
div.vis-editable.vis-selected {
/* custom styling for editable items... */
}
div.vis-readonly,
div.vis-readonly.vis-selected {
/* custom styling for readonly items... */
background-color: #ff4500;
border-color: red;
color: white;
}
</style>
<script src="dist/vis.js" rel="script"></script>
<script src="dist/vis.min.js" rel="script"></script>
<link href="dist/vis.css" rel="stylesheet" type="text/css" />
<link href="dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
<link href="dist/vis-timeline-graph2d.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>Specify individual items to be editable or readonly.</p>
<div id="visualization"></div>
<script>
// create groups to highlight groupUpdate
var items = new vis.DataSet({
type: { start: "ISODate", end: "ISODate" },
});
// create a DataSet with items
var items = new vis.DataSet([
{id: 1, content: 'Editable', editable: true, start: '2010-08-23', group: 1},
{id: 2, content: 'Editable', editable: true, start: '2010-08-23T23:00:00', group: 2},
{id: 3, content: 'Read-only', editable: false, start: '2010-08-24T16:00:00', group: 1},
{id: 4, content: 'Read-only', editable: false, start: '2010-08-26', end: '2010-09-02', group: 2},
{id: 5, content: 'Edit Time Only', editable: { updateTime: true, updateGroup: false, remove: false }, start: '2010-08-28', group: 1},
{id: 6, content: 'Edit Group Only', editable: { updateTime: false, updateGroup: true, remove: false }, start: '2010-08-29', group: 2},
{id: 7, content: 'Remove Only', editable: { updateTime: false, updateGroup: false, remove: true }, start: '2010-08-31', end: '2010-09-03', group: 1},
{id: 8, content: 'Default', start: '2010-09-04T12:00:00', group: 2}
]);
var container = document.getElementById('visualization');
var options = {
editable: true , // default for all items
height: "300px",
};
var timeline = new vis.Timeline(container, items,options);
</script>
</body>
</html>
example from web->> https://github.com/almende/vis/blob/master/examples/timeline/editing/individualEditableItems.html
i would appreciate any help here

Related

Download HTML as image

How can i download the output from this code automatically when accessing the page, not by clicking any button in the page like I need to automate the download process.
<!DOCTYPE html>
<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<body>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>
<script>
var xValues = [50,60,70,80,90,100,110,120,130,140,150];
var yValues = [7,8,8,9,9,9,10,11,14,14,15];
new Chart("myChart", {
type: "line",
data: {
labels: xValues,
datasets: [{
fill: false,
lineTension: 0,
backgroundColor: "rgba(0,0,255,1.0)",
borderColor: "rgba(0,0,255,0.1)",
data: yValues
}]
},
options: {
legend: {display: false},
scales: {
yAxes: [{ticks: {min: 6, max:16}}],
}
}
});
</script>
</body>
</html>

Kendo Editable Grid column attribute parseFormats is not working as expected

I am trying to make date column accept two formats using parseformats attribute, but it seems not picking up, please advise.
Scenario: When I input 10/10/19 it is showing inccorect date message. But when I input 10/10/2019, its working as no errors and displays in the format.
$(document).ready(function () {
$("#grid").kendoGrid({
toolbar: ["save"],
columns: [{
field: "name"
},
{
field: "age",
format: "{0:MM/dd/yyyy}",
parseFormats: ["MM/dd/yyyy", "MM/dd/yy"]
}
],
dataSource: {
data: [{
id: 1,
name: "Jane Doe",
age: "11/11/2019"
},
{
id: 2,
name: "John Doe",
age: "10/10/2018"
}
],
schema: {
model: {
id: "id",
fields: {
age: {
type: "date"
}
}
}
}
},
editable: true
});
});
<!DOCTYPE html>
<html>
<head>
<base href="http://demos.telerik.com/kendo-ui/datepicker/index">
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.common.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.default.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.default.mobile.min.css" />
<script src="https://kendo.cdn.telerik.com/2017.2.621/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js"></script>
</head>
<body>
<div id="grid"></div>
</body>
</html>
Try this
$(document).ready(function () {
$("#grid").kendoGrid({
toolbar: ["save"],
columns: [{
field: "name"
},
{
field: "age",
format: "{0:MM/dd/yyyy}",
parseFormats: ["MM/dd/yyyy", "MM/dd/yy"]
}
],
dataSource: {
data: [{
id: 1,
name: "Jane Doe",
age: "11/11/2019"
},
{
id: 2,
name: "John Doe",
age: "10/10/2018"
}
],
schema: {
model: {
id: "id",
fields: {
age: {
parse: function (value) {
var dt = kendo.parseDate(value,["MM/dd/yyyy", "MM/dd/yy"]);
return kendo.toString(dt, "MM/dd/yyyy");
},
validation: {
ageValidation: function (value) {
var dt = kendo.parseDate(value.val(),["MM/dd/yyyy", "MM/dd/yy"]);
value.attr("data-ageValidation-msg", "age is not valid date")
return dt !== null;
}
}
}
}
}
}
},
editable: true
});
});
<!DOCTYPE html>
<html>
<head>
<base href="http://demos.telerik.com/kendo-ui/datepicker/index">
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.common.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.default.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.default.mobile.min.css" />
<script src="https://kendo.cdn.telerik.com/2017.2.621/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js"></script>
</head>
<body>
<div id="grid"></div>
</body>
</html>

Is their any way to get selected nodes from KendoTreeView and show them in another KendoTreeView In Angular 5

I am trying to get all the selected nodes from KendoTreeView and display a Treeview with only selected values from the previous Tree.
Is this possible to achieve?
Thanks in advance.
Sure it is possible and below there is a rough way to do it, taken from this demo:
<!DOCTYPE html>
<html>
<head>
<base href="https://demos.telerik.com/kendo-ui/treeview/checkboxes">
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.3.1023/styles/kendo.common-fiori.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.3.1023/styles/kendo.fiori.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.3.1023/styles/kendo.fiori.mobile.min.css" />
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example">
<div class="demo-section k-content">
<div>
<h4>Check nodes</h4>
<div id="treeview"></div>
<hr>
<div id="treeview2"></div>
</div>
</div>
<script>
$("#treeview2").kendoTreeView();
$("#treeview").kendoTreeView({
checkboxes: {
checkChildren: true
},
check: onCheck,
dataSource: [{
id: 1, text: "My Documents", expanded: true, spriteCssClass: "rootfolder", items: [
{
id: 2, text: "Kendo UI Project", expanded: true, spriteCssClass: "folder", items: [
{ id: 3, text: "about.html", spriteCssClass: "html" },
{ id: 4, text: "index.html", spriteCssClass: "html" },
{ id: 5, text: "logo.png", spriteCssClass: "image" }
]
},
{
id: 6, text: "New Web Site", expanded: true, spriteCssClass: "folder", items: [
{ id: 7, text: "mockup.jpg", spriteCssClass: "image" },
{ id: 8, text: "Research.pdf", spriteCssClass: "pdf" },
]
},
{
id: 9, text: "Reports", expanded: true, spriteCssClass: "folder", items: [
{ id: 10, text: "February.pdf", spriteCssClass: "pdf" },
{ id: 11, text: "March.pdf", spriteCssClass: "pdf" },
{ id: 12, text: "April.pdf", spriteCssClass: "pdf" }
]
}
]
}]
});
// function that gathers IDs of checked nodes
function checkedNodeIds(nodes, checkedNodes) {
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].checked) {
checkedNodes.push(nodes[i]);
}
if (nodes[i].hasChildren) {
checkedNodeIds(nodes[i].children.view(), checkedNodes);
}
}
}
// show checked node IDs on datasource change
function onCheck() {
var checkedNodes = [],
treeView = $("#treeview").data("kendoTreeView"),
message;
checkedNodeIds(treeView.dataSource.view(), checkedNodes);
let treeView2 = $("#treeview2").data("kendoTreeView");
treeView2.dataSource.data(checkedNodes);
}
</script>
<style>
#treeview .k-sprite,
#treeview2 .k-sprite {
background-image: url("../content/web/treeview/coloricons-sprite.png");
}
.rootfolder { background-position: 0 0; }
.folder { background-position: 0 -16px; }
.pdf { background-position: 0 -32px; }
.html { background-position: 0 -48px; }
.image { background-position: 0 -64px; }
</style>
</div>
</body>
</html>
Demo in Dojo
The point is, you have to retrieve the selected nodes(as made with checkedNodeIds()) and then set them to the target treeview dataSource:
$("#treeview2").data("kendoTreeView").dataSource.data(checkedNodes);

JqGrid with subgrid and local data not working in IE9 - throws - "SCRIPT600: Invalid target element for this operation"

I am new to JQGRID and I am using version 4.7.1.
I am trying to create JQGRID with SUBGRID. The code is working as expected in Google chrome, but I am getting the below mentioned error in IE9.
SCRIPT600: Invalid target element for this operation.
jquery.jqGrid.src.js, line 1639 character 6
How can I resolve the error and make it work in IE9. Kindly do the needful.Thanks in advance.
<html>
<head>
<title>My First Grid</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery- ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.src.js" type="text/javascript"></script>
<style>
.ui-jqgrid tr.ui-row-ltr td
{
border-right-color: transparent;
height:auto;
overflow:hidden;
padding-top:6px;
padding-bottom:6px;
position:relative;
vertical-align:text-top;
white-space:normal !important;
}
th.ui-th-column { border-right-color: transparent !important }
.ui-jqgrid .ui-jqgrid-btable
{
table-layout:auto;
}
.top-buffer { margin-top:20px; }
.cursorPointer:hover{
cursor:pointer
}
.ui-jqgrid .ui-jqgrid-htable th div {
height:auto;
overflow:hidden;
padding-top:6px;
padding-bottom:6px;
position:relative;
vertical-align:text-top;
white-space:normal !important;
}
</style>
</head>
<body>
<div >
<table id="grid"></table>
</div>
</body>
<script type="text/javascript">
var mydata = [
{id: "1", label:"No 1", number:"02200220", status:"OPEN", level:"0", parent: "", isLeaf: false, expanded:false, loaded:true},
{id: "2", label:"No 2", number:"77733337", status:"ENTERED", level:"0", parent: "", isLeaf: false, expanded:false, loaded:true},
{id: "6", label:"No 2a", number:"12345123", status:"WIRED", level:"1", parent: "2", isLeaf: false, expanded:false, loaded:true},
{id: "7", label:"No 2a1", number:"1111111111", status:"WIRED", level:"2", parent: "6", isLeaf: true, expanded:false, loaded:true},
{id: "3", label:"No 3", number:"02200111", status:"OPEN", level:"0", parent: "", isLeaf: false},
{id: "4", label:"No 3a", number:"02200221", status:"OPEN", level:"1", parent: "3", isLeaf: true, expanded:false, loaded:true},
{id: "5", label:"No 3b", number:"02242320", status:"CLOSED", level:"1", parent: "3", isLeaf: true, expanded:false, loaded:true}
];
var grid = $("#grid");
grid.jqGrid({
// data: mydata, // doesn't work
datatype: "local",
colNames: ['Id', 'Label', 'Number', 'Status'],
colModel: [
{ name:'id',index:'id', width:60, sortable:false},
{ name: 'label', index: 'label', width: 180, sortable:false},
{ name: 'number', index: 'number', width: 120, formatter: function (cellValue, option, rowObject)
{
return "<span><img src='images/play.png'></img></span><span style='padding-left:10px'><img src='images/Download-icon.png'><span>";
} },
{ name: 'status', index: 'status', width: 120, sortable:false } ],
hidegrid: false,
gridview: true,
sortname: 'id',
loadonce: true,
treedatatype: 'local',
ExpandColumn: 'label',
height: 'auto',
pager : "#gridPager",
caption: "Prouct Page Table"
});
// we have to use addJSONData to load the data
grid[0].addJSONData({
total: 1,
page: 1,
records: mydata.length,
rows: mydata
});
</script>
</html>
TreeGrid don't works with datatype: "local", but one can use datatype: "jsonstring" instead. One need just use datastr: mydata instead of data: mydata. You should use parent: "null" instead of parent: "" additionally for top level icons. It allows to have local sorting additionally. See the answer for the corresponding code example.
The reason of the problem "jquery.jqGrid.src.js, line 1639" could be the bug with the usage of firstElementChild. See the answer for details. You can download code of jquery.jqGrid.src of jqGrid 4.7.0 after the fix from here. Alternatively you can download beta version of new free jqGrid from my fork of jqGrid.

jqGrid load in MVC

I'm new in jqgrid. I try to use jqgrid in my mvc project. I'm using the following code for mapping the data to grid. But its not working. The function GetJqGridData is loading first in my MVC project.
Below is code for Controler.
public ActionResult GetJqGridData()
{
var jqGridData = new JqGridObject()
{
Data = GetSomeSampleData(),
Page = "1",
PageSize = 3, // u can change this !
SortColumn = "1",
SortOrder = "asc"
};
return Json(jqGridData, JsonRequestBehavior.AllowGet);
}
Below is code for VIEW.
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="../../Content/jquery.jqGrid/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#myGrid").jqGrid({
url: '#Url.Action("GetJqGridData")',
datatype: 'json',
myType: 'POST',
colNames: ['Id', 'Name'],
colModel: [
{ name: 'Id', index: 'Id' },
{ name: 'Name', index: 'Name' }
],
jsonReader: {
root: 'Data',
id: 'id',
repeatitems: false
},
pager: $('#myPager'),
rowNum: 5,
rowList: [2, 5, 10],
width: 600,
viewrecords: true,
caption: 'Jqgrid MVC Tutorial'
});
});
</script>
<table id="myGrid"></table>
<div id="myPager"></div>
This is result i'm getting
Thanks
Bobbin
Try using the following json format:
{
"total": "xxx",
"page": "yyy",
"records": "zzz",
"rows" : [
{"id" :"1", "cell" :["cell11", "cell12", "cell13"]},
{"id" :"2", "cell":["cell21", "cell22", "cell23"]},
...
]
}
for more informations about the format, take a look in this link : http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data

Resources