how to code sap.m.sample.ListGrouping by using js view in openui5 - sapui5

hi i need List grouping control by using js view.but openui5 provides code by using xml view.
https://openui5.hana.ondemand.com/explored.html#/sample/sap.m.sample.ListGrouping/preview
how to convert this code into js view and how to make ListGrouping able to selection for both element level and group level and change this as dropdown box
List.view.xml
<mvc:View
controllerName="sap.m.sample.ListGrouping.List"
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<List
items="{
path: '/ProductCollection',
sorter: {
path: 'SupplierName',
descending: false,
group: true
},
groupHeaderFactory: '.getGroupHeader'
}"
headerText="Products" >
<StandardListItem
title="{Name}"
description="{ProductId}"
icon="{ProductPicUrl}"
iconDensityAware="false"
iconInset="false" />
</List>
</mvc:View>
List.controller.js
sap.ui.define([
'jquery.sap.global',
'sap/m/GroupHeaderListItem',
'sap/ui/core/mvc/Controller',
'sap/ui/model/json/JSONModel'
], function(jQuery, GroupHeaderListItem, Controller, JSONModel) {
"use strict";
var ListController = Controller.extend("sap.m.sample.ListGrouping.List", {
onInit : function (evt) {
// set explored app's demo model on this sample
var oModel = new JSONModel(jQuery.sap.getModulePath("sap.ui.demo.mock", "/products.json"));
this.getView().setModel(oModel);
},
getGroupHeader: function (oGroup){
return new GroupHeaderListItem( {
title: oGroup.key,
upperCase: false
} );
}
});
return ListController;
});
how to write the same code by using js view
I have tried like as follows, but i am getting Error: Missing template or factory function for aggregation items of Element sap.m.List#__list0 !
List.view.js
sap.ui.jsview("oui5mvc.List", {
getControllerName : function() {
return "oui5mvc.List";
},
createContent : function(oController) {
odbbshiftGlobalId = this.getId();
var oMyFlexbox = new sap.m.FlexBox({
items: [
oList = new sap.m.List({
width: '500px',
group: true,
groupHeaderFactory: '.getGroupHeader',
items: [
]
}),
]
});
oMyFlexbox.placeAt(this.getId()).addStyleClass("tes");
}
});
List.controller.js
sap.ui.controller("oui5mvc.List", {
onInit: function() {
var data = {
"ProductCollection": [
{
"ProductId": "1239102",
"Name": "Power Projector 4713",
"Category": "Projector",
"SupplierName": "Titanium",
"Description": "A very powerful projector with special features for Internet usability, USB",
"WeightMeasure": 1467,
"WeightUnit": "g",
"Price": 856.49,
"CurrencyCode": "EUR",
"Status": "Available",
"Quantity": 3,
"UoM": "PC",
"Width": 51,
"Depth": 42,
"Height": 18,
"DimUnit": "cm",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/demokit/explored/img/HT-6100.jpg"
},
{
"ProductId": "2212-121-828",
"Name": "Gladiator MX",
"Category": "Graphics Card",
"SupplierName": "Technocom",
"Description": "Gladiator MX: DDR2 RoHS 128MB Supporting 512MB Clock rate: 350 MHz Memory Clock: 533 MHz, Bus Type: PCI-Express, Memory Type: DDR2 Memory Bus: 32-bit Highlighted Features: DVI Out, TV Out , HDTV",
"WeightMeasure": 321,
"WeightUnit": "g",
"Price": 81.7,
"CurrencyCode": "EUR",
"Status": "Discontinued",
"Quantity": 10,
"UoM": "PC",
"Width": 34,
"Depth": 14,
"Height": 2,
"DimUnit": "cm",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/demokit/explored/img/HT-1071.jpg"
},
{
"ProductId": "K47322.1",
"Name": "Hurricane GX",
"Category": "Graphics Card",
"SupplierName": "Red Point Stores",
"Description": "Hurricane GX: DDR2 RoHS 512MB Supporting 1024MB Clock rate: 550 MHz Memory Clock: 933 MHz, Bus Type: PCI-Express, Memory Type: DDR2 Memory Bus: 64-bit Highlighted Features: DVI Out, TV-In, TV-Out, HDTV",
"WeightMeasure": 588,
"WeightUnit": "g",
"Price": 219,
"CurrencyCode": "EUR",
"Status": "Out of Stock",
"Quantity": 25,
"UoM": "PC",
"Width": 34,
"Depth": 14,
"Height": 2,
"DimUnit": "cm",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/demokit/explored/img/HT-1072.jpg"
},
],
"ProductCollectionStats": {
"Counts": {
"Total": 14,
"Weight": {
"Ok": 7,
"Heavy": 5,
"Overweight": 2
}
},
"Groups": {
"Category": {
"Projector": 1,
"Graphics Card": 2,
"Accessory": 4,
"Printer": 2,
"Monitor": 3,
"Laptop": 1,
"Keyboard": 1
},
"SupplierName": {
"Titanium": 3,
"Technocom": 3,
"Red Point Stores": 5,
"Very Best Screens": 3
}
},
"Filters": [
{
"type": "Category",
"values": [
{
"text": "Projector",
"data": 1
},
{
"text": "Graphics Card",
"data": 2
},
{
"text": "Accessory",
"data": 4
},
{
"text": "Printer",
"data": 2
},
{
"text": "Monitor",
"data": 3
},
{
"text": "Laptop",
"data": 1
},
{
"text": "Keyboard",
"data": 1
}
]
},
{
"type": "SupplierName",
"values": [
{
"text": "Titanium",
"data": 3
},
{
"text": "Technocom",
"data": 3
},
{
"text": "Red Point Stores",
"data": 5
},
{
"text": "Very Best Screens",
"data": 3
}
]
}
]
}
};
var oTemplate11 = new sap.m.StandardListItem({title : "{Name}"});
oList.setModel(new sap.ui.model.json.JSONModel(data));
oList.bindItems("/ProductCollection");
oList.placeAt('content');
},
getGroupHeader: function (oGroup){
return new sap.m.GroupHeaderListItem( {
title: oGroup.key,
upperCase: false
});
},
});

Your call to bind items to the list is not entirely correct.
The method takes an object with binding information as parameter instead of just the path to the model property. See the documentation for bindItems and bindAggregation in general.
In your case it should look like
oList.bindItems({
path: "/ProductCollection",
template: new sap.m.StandardListItem({
title: "{Name}",
description: "{ProductId}",
icon: "{ProductPicUrl}"
})
});

Related

Alexa fails to send skill request after connecting to MongoDb

I have a strange thing going on in my Alexa skill. My skill requires to connect with MongoDB and save data. Whenever I connect to database, Alexa is giving me this response: "There was a problem with the requested skill's response". It is completely weired because few days ago my database and Alexa skill were perfectly working. Now, suddenly, I don't get any response from Alexa even though my database in connected and creats documents.
Below is my JSON INPUT and code from the Launchrequesthandler :
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.b163d6da-ab3d-483c-ba19-60156810739c",
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQZ42AOOFESTFWW6VLTU63AHHQMMPKA74M2WX66TN4IYOZUNLMBXMX3LCUBWPO4FY"
}
},
"context": {
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 213,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"mode": "HUB",
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1280,
"pixelHeight": 800
}
}
}
}
],
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 346,
"arcMinuteHeight": 216,
"canRotate": false,
"canResize": false
}
],
"mode": "HUB",
"shape": "RECTANGLE",
"pixelWidth": 1280,
"pixelHeight": 800,
"dpi": 213,
"currentPixelWidth": 1280,
"currentPixelHeight": 800,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Extensions": {
"available": {
"aplext:backstack:10": {}
}
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQZ42AOOFESTFWW6VLTU63AHHQMMPKA74M2WX66TN4IYOZUNLMBXMX3LCUBWPO4FY"
},
"device": {
"deviceId": "amzn1.ask.device.AHVUJSCJ4KXLFF5SOTIFUCLYUXGBZFLUK3QURQHGX5S7N5E53K7O3ZXEO5V7KFPDR6XPPZECKTX5HEWB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c2VudFRva2VuIjpudWxsLCJkZXZpY2VJZCI6ImFtem4xLmFzay5kZXZpY2UuQUhWVUpTQ0o0S1hMRkY1U09USUZVQ0xZVVhHQlpGTFVLM1FVUlFIR1g1UzdONUU1M0s3TzNaWEVPNVY3S0ZQRFI2WFBQWkVDS1RYNUhFV0IzQlRMR0FNMzRKN0RWUEtPQUxGTk5EWENZRFVJUVdITkgzMjdIM0xDVjNSTlM3WEZRTE1KNkZYWjM2SkI1U0YzWVJVQUVVTEROSVFDQlNHWlBSN0o3S1BDR0NBSExQSlhWNVlSQSIsInVzZXJJZCI6ImFtem4xLmFzay5hY2NvdW50LkFGTVlWTktSQjNSRVVLR0RETEdJRk9ZWFI1M0lTRkxZSFFKWEhPMllEUllWUUNQQ1JMWVFGSVZMQkU1SERYSDZGTk1UTU40WUxYSFI2Wk1TSkVGUTNZMkJSSTc2TjJGSFNIRFhBV1VQVkZCNkpLV1NSVFBBN0VXT0g2Wk9GMjRLWTVEWFVCQTNVTVVZM1ROUVo0MkFPT0ZFU1RGV1c2VkxUVTYzQUhIUU1NUEtBNzRNMldYNjZUTjRJWU9aVU5MTUJYTVgzTENVQldQTzRGWSJ9fQ.MheHasYZKwNcTzwQLjt42C_yujmQJrGGHQ6tvWXt7uNTRzi73-MzzxXMOrztDYaBBCHmHZQS0Qy0-blTfgBT2Yqj5W5gAmcAc_CKKZhh4awlM1xGSAD87kOW8ZiLY2n68IfiKTsUHf6Bp4YiLOMcWWErSTCq91JeYeau0W7B5TvZGTm04OmfK-qkZBVPq6ME8_ulukdZUNxIpVUItkSEuhppcegUcGkzqYdrPRY0BJrsBe-Pytu5xLRiBM3T78nTysnGM288IJSccGJ4rmW4UdzHA_lnH7543QhgU9t71JRncgEDKEsEcVgxs5biFR9il4W8ASfwuDeJhdy8HpiXZw"
}
},
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.3e29f996-69b2-4e90-bfef-628d74f57307",
"locale": "en-US",
"timestamp": "2021-07-19T02:06:14Z",
"shouldLinkResultBeReturned": false
}
}
//database connection//
const q="mongodb+srv://sumya:sumya123#mydata.acxs0.mongodb.net/Mydata?retryWrites=true&w=majority";
mongoose.connect(q,{ useNewUrlParser: true, useUnifiedTopology: true,useFindAndModify: false })
.then(() => console.log("Database connected!")
)
.catch(err => console.log(err))
const Alexa = require('ask-sdk-core');
const LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
},
async handle(handlerInput) {
const speakOutput = 'Hi, I am Nao. I am here to give you counseling on your anxiety issues. Can I have your name, please? Note: We are not professional therapists or counselors. ';
const useri=handlerInput.requestEnvelope.session.user.userID;
const z=handlerInput.requestEnvelope.session.sessionId;
const g=Alexa.getUserId(handlerInput.requestEnvelope);
const curr_session=new post.session({
alexa_sessionid:z
});
let user=await post.findOne({userID:g});
if(!user){
user=new post({
userID:g
});
}
user.session_list.push(curr_session);
user.save();
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(speakOutput)
.getResponse();
}
};
Here is the Log that I got from Cloudwatch.
START RequestId: 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Version: 304
2021-07-19T16:40:00.570Z 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 INFO Database connected!
END RequestId: 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9
REPORT RequestId: 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Duration: 8008.11 ms Billed Duration: 8000 ms Memory Size: 512 MB Max Memory Used: 102 MB Init Duration: 653.49 ms
2021-07-19T16:40:08.023Z 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Task timed out after 8.01 seconds
START RequestId: 4e671447-8207-414e-aaf4-9a807fe3ac01 Version: 304
2021-07-19T16:40:08.894Z 4e671447-8207-414e-aaf4-9a807fe3ac01 INFO ~~~~ Session ended:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.05ca6843-cdc8-47eb-9a5f-081942cf2674",
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQZ42AOOFESTFWW6VLTU63AHHQMMPKA74M2WX66TN4IYOZUNLMBXMX3LCUBWPO4FY"
}
},
"context": {
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 213,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"mode": "HUB",
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1280,
"pixelHeight": 800
}
}
}
}
],
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 346,
"arcMinuteHeight": 216,
"canRotate": false,
"canResize": false
}
],
"mode": "HUB",
"shape": "RECTANGLE",
"pixelWidth": 1280,
"pixelHeight": 800,
"dpi": 213,
"currentPixelWidth": 1280,
"currentPixelHeight": 800,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Extensions": {
"available": {
"aplext:backstack:10": {}
}
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQZ42AOOFESTFWW6VLTU63AHHQMMPKA74M2WX66TN4IYOZUNLMBXMX3LCUBWPO4FY"
},
"device": {
"deviceId": "amzn1.ask.device.AHVUJSCJ4KXLFF5SO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EndedRequest",
"requestId": "amzn1.echo-api.request.bf2b3b37-7260-4813-a43c-b94ae49b45bf",
"timestamp": "2021-07-19T16:40:08Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}
}
If you are hosting skill in lambda, there may be a chance for timeout. Database operations may take time, meanwhile lambda closed the session.
I think following log line suggests the same.
**2021-07-19T16:40:08.023Z 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Task timed out after 8.01 seconds**
Also, we have to consider maximum time allowed for Alexa to receive the response from end point. It is good to cap the response by 8 secs. For more information : DeferredResponse

How get total distance and time from waypoints in HERE REST API

I need to get the total distance and time from waypoints in HERE REST API.
Now i use the routing api:
https://route.api.here.com/routing/7.2/calculateroute.json
"app_id=" + API_ID
"&app_code=" + APP_CODE
"&waypoint0=geo!" + fromCoordsLocation
"&waypoint1=geo!" + toCoordsLocation
"&mode=fastest;car"
and read them from json summary object (Response->Route->Summary). This method returns all the maneuvers and for long distances the callback is slow. there is something that allows only the summary (or the total distance and time) to be received?
Check out these additional properties so you can customize the request as you want. In this case I used representation = overview, your request will be
https://route.api.here.com/routing/7.2/calculateroute.json
"app_id=" + API_ID
"&app_code=" + APP_CODE
"&waypoint0=geo!" + fromCoordsLocation
"&waypoint1=geo!" + toCoordsLocation
"&mode=fastest;car&representation=overview"
The response will be decreased to 78 lines with default 232 lines:
{
"response": {
"metaInfo": {
"timestamp": "2019-11-14T10:03:16Z",
"mapVersion": "8.30.102.151",
"moduleVersion": "7.2.201945-5699",
"interfaceVersion": "2.6.74",
"availableMapVersion": [
"8.30.102.151"
]
},
"route": [
{
"waypoint": [
{
"linkId": "-53623477",
"mappedPosition": {
"latitude": 52.4999825,
"longitude": 13.3999652
},
"originalPosition": {
"latitude": 52.5,
"longitude": 13.4
},
"type": "stopOver",
"spot": 0.3538462,
"sideOfStreet": "left",
"mappedRoadName": "Neuenburger Straße",
"label": "Neuenburger Straße",
"shapeIndex": 0,
"source": "user"
},
{
"linkId": "+1215312511",
"mappedPosition": {
"latitude": 52.4992955,
"longitude": 13.4491968
},
"originalPosition": {
"latitude": 52.5,
"longitude": 13.45
},
"type": "stopOver",
"spot": 1.0,
"sideOfStreet": "left",
"mappedRoadName": "Schlesische Straße",
"label": "Schlesische Straße",
"shapeIndex": 56,
"source": "user"
}
],
"mode": {
"type": "fastest",
"transportModes": [
"car"
],
"trafficMode": "disabled",
"feature": []
},
"summary": {
"distance": 3847,
"trafficTime": 869,
"baseTime": 667,
"flags": [
"noThroughRoad",
"builtUpArea",
"park",
"privateRoad"
],
"text": "The trip takes <span class=\"length\">3.8 km</span> and <span class=\"time\">11 mins</span>.",
"travelTime": 667,
"_type": "RouteSummaryType"
}
}
],
"language": "en-us"
}
}

How to get multiple dimensions in Bar chart - SAPUI5 VizFrame

I am new to SAPUI5, I am trying to get multiple dimensions in Bar chart using VizFrame. I need chart to be displayed like the below image:
Please check my code.
I think you are looking for Bar graph to show the Amount vs Days.
Here is the working link.
I have updated _setupChart methods as below.
_setupChart: function() {
var oVizFrame = this.getView().byId("idVizFrame");
oVizFrame.setModel(new JSONModel('./data.json'));
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [{
name: "Days",
value: "{Days}"
}],
measures: [{
name: "Amount",
value: "{Amount}"
}],
data: {
path: "/dueDays"
}
});
oVizFrame.setDataset(oDataset);
oVizFrame.setVizType('bar');
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
"uid": "valueAxis",
"type": "Measure",
"values": ["Amount"]
});
var feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
"uid": "categoryAxis",
"type": "Dimension",
"values": ["Days"]
});
oVizFrame.addFeed(feedValueAxis);
oVizFrame.addFeed(feedCategoryAxis);
}
And also i have updated the data json as below
{
"dueDays": [{
"Days": "Current",
"Amount": "44334.00"
}, {
"Days": "1 to 30",
"Amount": "53454.00"
}, {
"Days": "31 to 60",
"Amount": "34443.65"
}, {
"Days": "61 to 90",
"Amount": "65554.43"
}, {
"Days": "91 to 120",
"Amount": "43524.00"
},{
"Days": "121 to 150",
"Amount": "54554.00"
}, {
"Days": "151 to 180",
"Amount": "43324.00"
}, {
"Days": "Above 180",
"Amount": "54355"
}]
}
Thanks for your work & time !! .. I have made it using setVizProperties > plotArea > dataPointStyle > rules .. This is the updated link.

Google Column Graph Single Date and value showing as multiple adjucent bars

Data Table structure is as follows
{
"cols": [
{
"id": "",
"label": "Date",
"pattern": "",
"type": "date"
},
{
"id": "Col1",
"label": "Col1 Label",
"pattern": "",
"type": "number"
}
],
"rows": [
{
"c": [
{
"v": "Date(2017, 5, 27)"
},
{
"v": 213
}
]
}
]
}
H Axis options
hAxis: {
slantedText: true, slantedTextAngle: 35,
titleTextStyle: {bold: false, fontSize: 11, color: '#610B38'},
textStyle: {
bold: true, fontSize: 8, color: '#4d4d4d'
},
maxAlternation: 1,
showTextEvery: 1,
viewWindowMode : 'maximized',
gridlines:
{
count: 31
},
bar: { groupWidth: 40 }
}
But in the column graph it is displaying multiple adjacent bars looks like time instead of a single date
This issue happening only for single date.
I want to display the column chart as single bar instead of big rectangle.
Any feedback appreciated
recommend setting the min / max values on the viewWindow explicitly
keeping within a day should prevent "column overflow"
viewWindow: {
min: new Date(dateRange.min.getTime() - oneDay),
max: new Date(dateRange.max.getTime() + oneDay)
}
see following working snippet...
google.charts.load('current', {
callback: function () {
drawChart();
$(window).on('resize', drawChart);
},
packages:['corechart']
});
function drawChart() {
var data = new google.visualization.DataTable({
"cols": [
{
"id": "",
"label": "Date",
"pattern": "",
"type": "date"
},
{
"id": "Col1",
"label": "Col1 Label",
"pattern": "",
"type": "number"
}
],
"rows": [
{
"c": [
{
"v": "Date(2017, 5, 27)"
},
{
"v": 213
}
]
}
]
});
var oneDay = (1000 * 60 * 60 * 24);
var dateRange = data.getColumnRange(0);
var chart = new google.visualization.ColumnChart($('.chart')[0]);
chart.draw(data, {
hAxis: {
slantedText: true,
slantedTextAngle: 35,
textStyle: {
bold: true,
fontSize: 8,
color: '#4d4d4d'
},
viewWindow: {
min: new Date(dateRange.min.getTime() - oneDay),
max: new Date(dateRange.max.getTime() + oneDay)
}
}
});
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div class="chart"></div>
not much you can do for the actual size of the column
the release notes from February, 23 2016 mention...
Added options to specify bar.width, bar.gap, bar.group.width (was bar.groupWidth) and bar.group.gap.
but none have ever worked for me when only one row of data...

Kendo grid with declarative editor template

Hopefully someone can help me with this - I've been staring at this for 8 hours and can't seem to find a solution. I'm trying to implement a pretty simple Kendo UI MVVM grid. The grid just has a list of roles with an attached category. When you click edit, the grid should allow an inline edit and the category column should turn into a drop down - which is a template that is also bound to a field in the view model.
Here's my jsfiddle: http://jsfiddle.net/Icestorm0141/AT4XT/3/
The markup:
<script type="text/x-kendo-template" id="someTemplate">
<select class="form-control categories" data-auto-bind="false" data-value-field="CategoryId" data-text-field="Description" data-bind="source: categories"></select>
</script>
<div class="manage-roles">
<div data-role="grid"
data-scrollable="true"
data-editable="inline"
data-columns='[
{ "field" : "JobTitle", "width": 120, "title" : "Job Title Code" },
{ "field" : "Description" },
{ "field" : "Category", "template": "${Category}","editor" :kendo.template($("#someTemplate").html()) },
{"command": "edit"}]'
data-bind="source: roles"
style="height: 500px">
</div>
</div>
And the javascript:
var roleViewModel = kendo.observable({
categories: new kendo.data.DataSource({
data: [
{ "CategoryId": 1, "Description": "IT" },
{ "CategoryId": 2, "Description": "Billing" },
{ "CategoryId": 3, "Description": "HR" },
{ "CategoryId": 4, "Description": "Sales" },
{ "CategoryId": 5, "Description": "Field" },
{ "CategoryId": 10, "Description": "Stuff" },
{ "CategoryId": 11, "Description": "Unassigned" }
]
}),
roles: new kendo.data.DataSource({
data: [
{ "RoleId": 1, "JobTitle": "AADM1", "Description": "Administrative Assistant I", "Category": "Stuff", "CategoryId": 10 },
{ "RoleId": 2, "JobTitle": "AADM2", "Description": "Administrative Assistant II", "Category": null, "CategoryId": 0 },
{ "RoleId": 3, "JobTitle": "ACCIN", "Description": "Accounting Intern", "Category": null, "CategoryId": 0 },
{ "RoleId": 4, "JobTitle": "ACCSU", "Description": "Accounting Supervisor", "Category": null, "CategoryId": 0 }, { "RoleId": 5, "JobTitle": "ACCTC", "Description": "Accountant", "Category": null, "CategoryId": 0 }
]
})
});
kendo.bind($(".manage-roles"), roleViewModel);
I havent been able to figure out why the editor template is not binding the drop down. When I use the same markup for template rather than binding to the category name with ${Category}, it works for the template property. (For some reason this doesnt work in fiddle. But the exact same code works locally).
At this point I'll take any suggestions/approaches anything. I really wanted to use MVVM and not the .kendoGrid() syntax but I'll get over myself if it cannot be done. Anyone got any insight into whats going on with the editor template?
You can still build your grid using MVVM, but I think you have to make custom editors with a function call.
So instead of "editor" :kendo.template($("#someTemplate").html()), you just call a function.
edit: rolesViewModel.categoryEditor
See http://demos.kendoui.com/web/grid/editing-custom.html
See sample http://jsbin.com/UQaZaXO/1/edit