I'm use jquery gantt with ruby on rails and i need create dynamically, how i make this? i dont find no one tutorial :/
$(function() {
"use strict";
<%= raw @alert %>
var today = moment();
var andTwoHours = moment().add("hours",2);
var today_friendly = "/Date(" + today.valueOf() + ")/";
var next_friendly = "/Date(" + andTwoHours.valueOf() + ")/";
//var today_friendly = today.toDate();
//var next_friendly = andTwoHours.toDate();
var maxDate = moment().add("days",10).toDate();
<%= raw @mapa %>
$(".gantt").gantt({
source: [{
name:"Aplicação teste",
values: [{
from: today_friendly,
to: next_friendly,
label:"Teste",
customClass: "ganttRed"
}]
}],
scale: "hours",
minScale: "hours",
navigate: "scroll",
waitText: "Aguarde...",
dow: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]
});
$(".gantt").popover({
selector: ".bar",
title: "Algum título teste",
content: "Conteúdo teste legal.",
trigger: "hover"
});
console.log(today.format("HH"));
//prettyPrint();
});
I just add other task in gantt, thanks very much!