when i click on calender cell lightbox open and then close automatically - scheduler

When i Click on the calender cell, lightbox open and then automatically close.Below is my code.
scheduler.attachEvent("onEmptyClick", function(id, e) {
var action_data = scheduler.getActionData(e);
var event = {
start_date: action_data.date,
end_date: scheduler.date.add(action_data.date, 5, "minute"),
stylist_id: action_data.section
};
var eventId = scheduler.addEventNow(event);
var profId = event.stylist_id;
$.ajax({
type: "POST",
dataType: 'json',
url: 'loadMultipleServices',
data: "prof_id=" + profId,
success: function(data) {
service_section = JSON.parse(data.services);
lightBoxWithAddedServices = scheduler.config.lightbox.sections = [
{name: "Event", height: 30, map_to: "text", type: "textarea", focus: true},
{name: "Professionals", height: 23, type: "select", options: sections, map_to: "stylist_id"},
{name: "Clients", height: 23, type: "select", options: client_section, map_to: "client_id"},
{name: "Services", height: 23, type: "select", options: service_section, map_to: "service_id"},
{name: "Description", height: 40, map_to: "description", type: "textarea", focus: true},
{name: "Owner", height: 23, type: "textarea", map_to: "owner_id"},
{name: "time", height: 72, type: "time", map_to: "auto"}
];
**scheduler.resetLightbox();**
**scheduler.showLightbox(eventId);**
}
});
});

Calling scheduler.resetLightbox while one is open can cause this. Try creating event from the ajax callback without reopening the form.
I.e. something following
var action_data = scheduler.getActionData(e);
$.ajax({
type: "POST",
dataType: 'json',
url: 'loadMultipleServices',
data: "prof_id=" + action_data.section,
success: function(data) {
service_section = JSON.parse(data.services);
lightBoxWithAddedServices = scheduler.config.lightbox.sections = [
{name: "Event", height: 30, map_to: "text", type: "textarea", focus: true},
{name: "Professionals", height: 23, type: "select", options: sections, map_to: "stylist_id"},
{name: "Clients", height: 23, type: "select", options: client_section, map_to: "client_id"},
{name: "Services", height: 23, type: "select", options: service_section, map_to: "service_id"},
{name: "Description", height: 40, map_to: "description", type: "textarea", focus: true},
{name: "Owner", height: 23, type: "textarea", map_to: "owner_id"},
{name: "time", height: 72, type: "time", map_to: "auto"}
];
scheduler.resetLightbox();
var event = {
start_date: action_data.date,
end_date: scheduler.date.add(action_data.date, 5, "minute"),
stylist_id: action_data.section
};
scheduler.addEventNow(event);
}
});

Related

Apexcharts fade configuration for area chart

I am trying to create a chart that will look like this:
https://i.stack.imgur.com/9KpYO.png
but I am getting this:
https://i.stack.imgur.com/oA7Vm.png
This is my configuration:
{
chartOptions: {
chart: {
type: 'area',
height: 200,
toolbar: { show: false },
zoom: { enabled: false },
},
colors: ["#01c40e"],
grid: { show: false},
dataLabels: { enabled: false },
legend: { show: false },
stroke: {
curve: 'straight',
width: 2,
},
xaxis: {
type: 'numeric',
labels: {show: false},
axisBorder: {show:false},
axisTicks: {show:false},
},
yaxis: {
type: 'numeric',
labels: {show: false},
axisBorder: {show:false},
axisTicks: {show:false},
},
fill: {
type: "gradient",
gradient: {
shade: "light",
type: "vertical",
shadeIntensity: 0,
opacityFrom: 0.2,
opacityTo: 0.7,
stops: [0, 50, 80, 100]
}
},
tooltip: { enabled: false}
},
series: [{
name: 'Series A',
type: "area", // this is not in documentation but without it i get line, not area
data: [4852, 4840, 4845, 4859, 4862, 4852]
}]
}
Mostly it is about the fill configuration which fills the area too much and instead of fill being highest at the top, it is at the bottom, which makes the gradient inverse of what I need.
try swapping the values for opacityFrom and opacityTo,
and removing the option for stops
fill: {
type: "gradient",
gradient: {
shade: "light",
type: "vertical",
shadeIntensity: 0,
opacityFrom: 0.7,
opacityTo: 0.2
}
},
see following working snippet...
$(document).ready(function() {
var chart = new ApexCharts(
document.getElementById('chart'),
{
chart: {
type: 'area',
height: 200,
toolbar: { show: false },
zoom: { enabled: false },
},
colors: ["#01c40e"],
grid: { show: false},
dataLabels: { enabled: false },
legend: { show: false },
stroke: {
curve: 'straight',
width: 2,
},
xaxis: {
type: 'numeric',
labels: {show: false},
axisBorder: {show:false},
axisTicks: {show:false},
},
yaxis: {
type: 'numeric',
labels: {show: false},
axisBorder: {show:false},
axisTicks: {show:false},
},
fill: {
type: "gradient",
gradient: {
shade: "light",
type: "vertical",
shadeIntensity: 0,
opacityFrom: 0.7,
opacityTo: 0.2
}
},
tooltip: { enabled: false},
series: [{
name: 'Series A',
type: "area", // this is not in documentation but without it i get line, not area
data: [4852, 4840, 4845, 4859, 4862, 4852]
}]
}
);
chart.render();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<div id="chart"></div>

eCharts: dataZoom only shows information for the first category

Noticed that dataZoom in echarts only display series for the first category rather than a total across all categories.
For example, consider a cluster bar chart that contains 3 categories (2015,2016,2017). DataZoom displays trend for the 2015 by default rather than total across 2015,2016 and 2017. Any recommendations on how to improve the display as it might be misleading to the end user?
option = {
legend: {},
tooltip: {},
dataset: {
source: [
['product', '2015', '2016', '2017'],
['Matcha Latte', 43.3, 185.8, 93.7],
['Milk Tea', 83.1, 73.4, 55.1],
['Cheese Cocoa', 86.4, 65.2, 82.5],
['Walnut Brownie', 72.4, 53.9, 39.1]
]
},
xAxis: {type: 'category'},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
dataZoom: [
{
show: true,
type: 'slider',
start: 0,
end: 100,
filterMode: 'filter'
},
{
type: 'inside',
start: 0,
end: 100
},
{
show: false,
yAxisIndex: 0,
filterMode: 'empty',
width: 30,
height: '80%',
showDataShadow: false,
left: '93%'
}
],
series: [
{type: 'bar'},
{type: 'bar'},
{type: 'bar'}
]
};
Thanks,
Dee
Could you explain «DataZoom displays trend for the 2015 by default»? I tried to find the troubles and just pasted you code to editor. It's look as was expected — DataZoom show all clusters, what's wrong?
var myChart = echarts.init(document.getElementById('main'));
var option = {
legend: {},
tooltip: {},
dataset: {
source: [
['product', '2015', '2016', '2017'],
['Matcha Latte', 43.3, 185.8, 93.7],
['Milk Tea', 83.1, 73.4, 55.1],
['Cheese Cocoa', 86.4, 65.2, 82.5],
['Walnut Brownie', 72.4, 53.9, 39.1]
]
},
xAxis: {type: 'category'},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
dataZoom: [
{
show: true,
type: 'slider',
start: 0,
end: 100,
filterMode: 'filter'
},
{
type: 'inside',
start: 0,
end: 100
},
{
show: false,
yAxisIndex: 0,
filterMode: 'empty',
width: 30,
height: '80%',
showDataShadow: false,
left: '93%'
}
],
series: [
{type: 'bar'},
{type: 'bar'},
{type: 'bar'}
]
};
myChart.setOption(option);
<script src="https://cdn.jsdelivr.net/npm/echarts#4.8.0/dist/echarts.min.js"></script>
<div id="main" style="width: 600px;height:400px;"></div>

Split dhtmlxForm attached to dhtmlxSidebar

I have a problem with a split-form which is attached to a dhtmlxSidebar. Unfortunately the dhtmlxEditor doesn’t work that way and is read only somehow.
Here's my dhtmlxForm structure:
var formData_technik = [
{ type: "settings", position: "label-left"},
{ type: "block", id: "eintragung", inputWidth: 650, list: [
{ type: "combo", label: "Studio: ", inputWidth: 200, labelWidth: 60, name: "technik_studio", required: "true" },
{ type: "input", label: "Problem", name: "technik_problem", rows: "1", selected: "true", labelWidth: 60, inputWidth: 450, required: "true", note: {text: "kurze Beschreibung"}},
{ type: 'editor', name: 'technik_detail', label: 'Problembeschreibung', labelWidth: 400, inputWidth: 620, inputHeight: 240, value: "" },
{ type: "combo", label: "Eingetragen von", name: "technik_user", inputWidth: 200, labelWidth: 70, disabled: true }
]},
{ type: "block", id: "bearbeitet", list: [
{ type: "checkbox", label: "Problem behoben", name: "technik_behoben", inputWidth: 20, position: "label-right" },
{ type: "combo", label: "Behoben von", name: "technik_behobenvon", inputWidth: 200, labelWidth: 90, disabled: true },
{ type: "calendar", label: "Behoben am", name: "technik_behobenwann", dateFormat: "%d.%m.%Y %H:%i", serverDateFormat: "%Y-%m-%d %H:%i:%s", enableTime: "true", labelWidth: 90, inputWidth: 120, disabled: true },
{ type: 'editor', name: 'technik_behobenkommentar', label: 'Problembeschreibung', labelWidth: 400, inputWidth: 620, inputHeight: 240, value: "" }
]}
];
var initValues = {technik_behobenkommentar: "123 234 345"};
May be this approach could help you:
mySidebar = new dhtmlXSideBar({ parent: "sidebarObj", icons_path: "win_16x16/", width: 160, items: [ {id: "recent", text: "Recent", icon: "recent.png", selected: true}, {id: "desktop", text: "Desktop", icon: "desktop.png"}] });
myForm = mySidebar.cells("recent").attachForm(formData_technik);
mySidebar.cells("desktop").attachObject("bearbeitet");
mySidebar.attachEvent("onSelect", function(id){
if (id == "recent" || id == "desktop") {
var editorId = {recent:"technik_detail", desktop: "technik_behobenkommentar"}[id];
myForm.getEditor(editorId)._prepareContent(true);
myForm.setItemValue(editorId, initValues[editorId]);
initValues[editorId] = null;
}
});

Dojo-DataGrid :: How to dynamically fetch values as options for a select box in Dojo DataGrid

I have a Dojo-DataGrid which is programatically populated as below :
var jsonStore = new dojo.data.ItemFileWriteStore({ url: "json/gaskets.json" });
var layout= [
{ field: "description", width: "auto", name: "Tier/Description", editable:true },
{ field: "billingMethod", width: "auto", name: "Billing Method", editable: true,
type: dojox.grid.cells.Select, options: [ '0', '1' ] },
{ field: "offeringComponents", width: "auto", name: "Offering Component", editable: true,
type: dojox.grid.cells.Select, options: [ '0', '1' ] },
{ field: "serviceActivity", width: "auto", name: "Service Activity", editable: true,
type: dojox.grid.cells.Select, options: [ '0', '1' ] },
{ field: "hours", width: "auto", name: "Hours" },
{ field: "rate", width: "auto", name: "Rate <br/> (EUR)" },
{ field: "cost", width: "auto", name: "Cost <br/> (EUR)" },
{ field: "price", width: "auto", name: "Price <br/> (EUR)" },
{ field: "gvn", width: "auto", name: "Gvn" }
];
grid = new dojox.grid.DataGrid({
query: { description: '*' },
store: jsonStore,
structure: layout,
rowsPerPage: 20
}, 'gridNode');
The options for the field billingMethod (Currently defined as dojox.grid.cells.Select) are hard coded right now, but I would like to get those values dynamically from the backend as JSON. But dojox.grid.cells.Select currently(I am using Dojo 1.5) does not have a option to define a "store".
I am trying to use dijit.form.FilteringSelect, but this needs a id(of a Div) for its constructor and I cannot specify one as this select box has to go with in the grid, rather than a separate DIV.
Thanks
Sandeep
Your answer works fine, the issue is that in the combo the user can select A, but once the combo lose the focus, the value 1 will be shown. Some months ago I had the same problem, and I got a solution from KGF on #dojo. The idea is to have a formatter on the cell that just creates a SPAN element, and then it invokes a query over the store to get the label of the selected element and put it on the SPAN. I modified your example to get that working.
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojox.grid.cells.dijit");
dojo.require("dojox.grid.DataGrid");
dojo.require("dijit.form.Select");
dojo.require('dojox.grid.cells.dijit');
dojo.require('dijit.form.FilteringSelect');
var grid;
var jsonStore;
dojo.addOnLoad(function() {
jsonStore = new dojo.data.ItemFileWriteStore({
data: {
"identifier": "identify",
"label": "description",
"items": [
{
"identify": 123,
"description": "Project Manager"},
{
"identify": 234,
"description": "Developer"},
{
"identify": 536,
"description": "Developer",
"billingMethod":2}
]
}
});
var myStore = new dojo.data.ItemFileReadStore({
data: {
identifier: 'value',
label: 'name',
items: [{
value: 1,
name: 'A',
label: 'A'},
{
value: 2,
name: 'B',
label: 'B'},
{
value: 3,
name: 'C',
label: 'C'}]
}
});
//[kgf] callback referenced by formatter for FilteringSelect cell
function displayValue(nodeId, store, attr, item) {
if (item != null) { //if it's null, it wasn't found!
dojo.byId(nodeId).innerHTML = store.getValue(item, attr);
}
}
var layout = [
{
field: "identify",
width: "auto",
name: "Id 2 Hide",
hidden: true},
{
field: "description",
width: "auto",
name: "Tier/Description",
editable: true},
{
field: 'billingMethod',
name: 'Billing Method',
editable: true,
required: true,
width: '150px',
type: dojox.grid.cells._Widget,
widgetClass: dijit.form.FilteringSelect,
widgetProps: {
store: myStore
},
formatter: function(data, rowIndex) { //[kgf]
//alert("data "+data)
var genId = 'title' + rowIndex;
var store = this.widgetProps.store;
var attr = "label";
setTimeout(function() {
store.fetchItemByIdentity({
identity: data,
onItem: dojo.partial(displayValue, genId, store, attr)
});
}, 50);
//for now return a span with a predetermined id for us to populate.
return '<span id="' + genId + '"></span>';
}
}
];
grid = new dojox.grid.DataGrid({
query: {
description: '*'
},
store: jsonStore,
singleClickEdit: true,
structure: layout,
rowsPerPage: 20
}, 'gridNode');
grid.startup();
});
I was finally able to figure this out..Incase someone wants to implement same kind of stuff using DOJO Datagrid+FilteringSelect.
Sample Code
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojox.grid.cells.dijit");
dojo.require("dojox.grid.DataGrid");
dojo.require("dijit.form.Select");
dojo.require('dojox.grid.cells.dijit');
dojo.require('dijit.form.FilteringSelect');
var grid;
var jsonStore;
dojo.addOnLoad(function() {
jsonStore = new dojo.data.ItemFileWriteStore({
data: {
"identifier": "identify",
"label": "description",
"items": [
{
"identify": 123,
"description": "Project Manager"},
{
"identify": 234,
"description": "Developer"},
{
"identify": 536,
"description": "Developer"}
]
}
});
var myStore = new dojo.data.ItemFileReadStore({
data: {
identifier: 'value',
label: 'name',
items: [{
value: 1,
name: 'A',
label: 'A'},
{
value: 2,
name: 'B',
label: 'Y'},
{
value: 3,
name: 'C',
label: 'C'}]
}
});
var layout = [
{
field: "identify",
width: "auto",
name: "Id 2 Hide",
hidden: true},
{
field: "description",
width: "auto",
name: "Tier/Description",
editable: true},
{
field: 'billingMethod',
name: 'Billing Method',
editable: true,
required: true,
width: '150px',
type: dojox.grid.cells._Widget,
widgetClass: dijit.form.FilteringSelect,
widgetProps: {
store: myStore
}}
];
grid = new dojox.grid.DataGrid({
query: {
description: '*'
},
store: jsonStore,
singleClickEdit: true,
structure: layout,
rowsPerPage: 20
}, 'gridNode');
grid.startup();
});

Passing variables through URL in Jqgrid to controller in mvc

How do I pass values from url to Jqgrid, the issue is the Jqgrid needs to be loaded based on edit link on previous page, and we have the URL like:
http://localhost:49771/Search/EditSearchResults?id=ID_HelpTopics&action=edit
I need to be able to use this id in URL for populating the grid data, so I need to pass this value through grid to controller to get the results and the grid I have is like:
$("#list").jqGrid({
url: '<%= Url.Action("EditSearchResults", new {controller = "JSonData" }) %>',
datatype: 'json',
colNames: ['Language', 'ID'],
colModel: [
{ name: 'Language', index: 'Language', editable: false, width: 40, align: 'left', sortable: false },
{ name: 'ID', index: 'ID', width: 40, editable: true, edittype: "text", align: 'left', editoptions: { size: 5, maxlength: 30 }, sortable: false }, ],
editurl: '<%= Url.Action("EditSearchResults", new {controller = "JSONData"}) %>',
pager: '#pager',
//autowidth: true,
width: "500",
autowidth: true,
rowNum: 20,
height: "200",
loadonce: false,
rowList: [5, 10, 20, 50],
recordtext: "View Records {0} - {1} of {2}",
emptyrecords: "No records to view",
loadtext: "Loading...",
pgtext: "Page {0} of {1}",
sortname: 'Results',
sortorder: "desc",
viewrecords: true,
scroll: false,
loadonce: false,
caption: 'Edit Search Results',
ondblClickRow: function (id) {
if (id != null) {
jQuery('#grid').jqGrid('restoreRow', lastsel);
jQuery('#list').jqGrid('saveRow', id);
jQuery('#list').jqGrid('editRow', id, true, false, processEdit);
lastsel = id;
}
}
});
});
How can use the current URL to pass id to controller to populate jqgrid, How should the controller and jqgrid should be like? Any ideas?
Url.Action will take a anonymous object as a parameter set
url: '<%= Url.Action("EditSearchResults",
new {controller = "JSonData" },
new {id = Request.Params[id] }) %>',
However it would be preferable to make that part of your model than depending on the Request.