How to set current location manually in the map (sencha touch2)? - sencha-touch-2

How can i set current location manually in the map (sencha touch 2), because proxy is not allowing me send my current location
For instance:
...
items: [
{
xtype: 'map',
longitude: 'X',
latitude: 'Y'
}
]

Use the following config option:
useCurrentLocation: true

Related

Deploying AWS Cloudwatch dashboards with the CDK: how do I hide metrics

I have a custom metric that I push updates to in my code. In the CDK, I have created a derived metric from this custom metric. I would like the derived metric to show up in the dashboard but the original metric to be hidden. How can I achieve this?
Here is my cut-down (TypeScript) CDK code which deploys successfully:
const createDashboard = (scope: cdk.Construct, namespace: string, statistic = Statistic.AVERAGE) => {
const customDynamoLatencyMetric: IMetric = new Metric({
period: Duration.minutes(1),
metricName: 'MY_DYNAMO_LATENCY_METRIC',
namespace,
statistic,
});
const derivedAverageDynamoLatencyMetric = new MathExpression({
expression: 'm1/1000', label: 'To Dynamo Latency', usingMetrics: { m1: customDynamoLatencyMetric }, period: Duration.minutes(1),
});
const dashboard = new Dashboard(
scope,
'myDashboard', {
dashboardName: 'myDashboard',
},
);
const widget = new GraphWidget({
title: 'Average Latency',
left: [customDynamoLatencyMetric, derivedAverageDynamoLatencyMetric],
view: GraphWidgetView.TIME_SERIES,
region: AWS_DEFAULT_REGION,
width: 12,
});
dashboard.addWidgets(widget);
};
If I manually mark this metric as invisible in the AWS Cloudwatch Dasgboard Console then when I view/edit source in the Cloudwatch Console I see the following:
"metrics": [
[ "stephenburns-gcs-pipeline", "DYNAMO_LATENCY", { "id": "m1", "visible": false } ],
[ { "label": "To Dynamo Latency", "expression": "m1/1000", "period": 60, "id": "e1", "region": "ap-southeast-2" } ]
]
My question is how do I get that "visible": false property via the CDK?
I tried using the Metric's dimensions property e.g.
dimensions: { visible: false }
but it fails at deployment time with the error: "Invalid metric field type, only "String" type is allowed"
Does anyone know how to mark a metric as initially invisible?
If you only add the original Metric to the usingMetrics property of the MathExpression and don't add it directly to the GraphWidget, the CDK appears to automatically set visible to false. The CDK documentation does not currently (as of version 1.123.0) indicate a way to set the visibility of a Metric directly.
In the code example you provided, this would simply require changing the line:
left: [customDynamoLatencyMetric, derivedAverageDynamoLatencyMetric],
to:
left: [customDynamoLatencyMetric],

Is there any solution for remove or hide top toolbar section in flexmonster with react-native?

I trying to hide/remove toolbar section( CSV, JSON, OLAP, etc) on my app, which is using react-native-flexmonster, as seen on the image below:
I tried this, but without success
Here is my code:
<FlexmonsterReactNative.Pivot
container= "pivot-container"
toolbar={false}
report = {{
dataSource: {
filename: "data/data.csv"
},
slice: {
columns: [{
uniqueName: "Color"
}],
rows: [{
uniqueName: "Country"
}, {
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "Price",
format: "currency"
}, {
uniqueName: "Discount",
format: "currency"
}],
},
formats: [{
name: "currency",
currencySymbol: "$",
currencySymbolAlign: "left",
thousandsSeparator: ",",
decimalPlaces: 2
}],
conditions: [{
formula: "#value < 2000",
measure: "Discount",
format: {
backgroundColor: "#CCFFCC",
}
}, {
formula: "AND(#value > 2000, #value < 4000)",
measure: "Discount",
format: {
backgroundColor: "#FFFF99",
}
}]
}}
/>
Some features provided by Flexmonster are not available in React Native while using their module due to some limitations it imposes on the execution of JavaScript.
It includes enabling/disabling the Toolbar.
Even so, it is possible to modify the module itself in the way the desired configuration is adjusted.
For example, the possibility to disable the Toolbar be achieved using the following approach:
Download the module mentioned earlier and modify the following code snippet in the way the toolbar property of the created instance is set to false: https://github.com/flexmonster/react-native-flexmonster/blob/f8d0f7fd6614c06e1a31585c8b8cbe22e3bc653e/src/index.js#L360-L371.
For example:
<script>
new Flexmonster({
container: "#pivot-container",
componentFolder: "<https://cdn.flexmonster.com/>",
toolbar: false,
height: ${height},
width: ${width},
report: JSON.parse('${JSON.stringify(this.props.report)}')
});
${this.registerEvents()}
</script>
Please note that in case such methods are required, the module should be downloaded and connected manually instead of installation through npm.

How to replace placeholder images with local images in Buefy Carousel?

I have copied the Buefy carousel component from https://buefy.org/documentation/carousel#carousel-list into my Gridsome project. The carousel displays correctly with its supplied placeholder images. These are in an array in the data() segment eg
items: [
{
title: 'Slide 1',
image: 'https://picsum.photos/id/0/1230/500'
},
Now I want my images, not the Buefy placeholder ones.
I cannot find the right way to target my local images. I have tried lots of things including
items: [
{
title: 'Slide 1',
image: require("#/assets/img/gallery/sheep/sheep2.jpg")
},
My attempts either break the carousel or display a broken link within it.
Solved. I did a new build (in my case "gridsome develop") after inserting my own image paths. Then this worked fine -
items: [
{
title: "Slide 1",
image: require("#/assets/img/gallery/sheep/sheep1.jpg")
},

On Sencha Touch 2.2.0 it is not possible to enable the default browser scroll

The new Sencha Touch 2.2.0 has a new configuration parameter on scrollable to don't use the Ext.scroll.Scroller, but actually this is not working.
I am using this to activate the overflow scroll on my container:
{
scrollable: null,
style: 'overflow:auto; -webkit-overflow-scrolling: touch;'
}
How can I use the native scroll ?
Why I need it?
Because I need to use a galaxy-tab-1 the new Ext.scroll.Scroller is faster than 2.1.1 version but the render on this tablet is slow and the new Ext.scroll.Scroller is trying to render 40 fps and the tablet is displaying this slowly.
Actually the setFps() is not working in this version, example:
Econtainer.getScrollable().getScroller().setFps(10);
The new Ext.util.Translatable has an slowly PreferredTranslationMethod by default.
You can use:
scrollable: {
direction: 'both',
translatable: {
translationMethod: 'scrollposition'
}
},
or
scrollable: {
direction: 'both',
translatable: {
translationMethod: 'csstransform'
}
},
or
scrollable: {
direction: 'both',
translatable: {
translationMethod: 'cssposition'
}
},

How to stop extjs treepanel from loading infinitely?

Finally after struggling with extjs tree panel, tree store and building custom reader to read and convert pentaho data for 2 weeks I have managed to load pentaho data into treepanel of extjs.
Now my Tree panel is loading same data infinitely.
Treepanel looks as follows :
Part of my json data looks as follows :
{
{name: 'US', candidateCount: 3, children: []},
{name: 'India', candidateCount: 922, children: [
{name: 'Goa', candidateCount:124, children: []},
{name: 'Maharashtra', candidateCount: 43, children: [
{name: 'Pune', candidateCount: 3},
{name: 'Mumbai', candidateCount: 33},
{name: 'Kolhapur', candidateCount: 4},
{name: 'XXX', candidateCount: 3},
]}
]},
{name: 'UK', candidateCount: 1, children: []},
}
As you can see in image above, after expanding India node it has again loaded data of country level (i.e. country names US, uk, India, UK). Actually I want to show state level data like data of Maharashtra, Goa. Instead of that treepanel is again loading same data again.
How to avoid this kind of behavior? I have already set leaf property of US, uk and India nodes to false.
I tried setting Expanded property to true but then treepanel keeps loading same nodes again and again and my browser tab just gets hanged.
Please let me know how to avoid this? I want tree panel to load data only once.
EDIT - Solution to this problem
I solved this problem by adding listener on append event of store and then setting leaf value to true for the nodes which I wanted to be leaf.
I had the same problem with my treepanel and JSON data. My treeStore looks something like this:
proxy: {
type: 'ajax',
url: 'urlJson',
reader: {
type: 'json',
root: 'instanceList',
successProperty: 'success'
}
},
root:{
text: 'Root',
expanded: true
}
And the JSON
{
"instanceList": [
{
"text": "Parent 1",
"instanceList": [
{
"class": "testing",
"id": 3,
"leaf": true,
"text": "Child 1"
}
]
},
{
"text": "Parent 2",
"instanceList": [
{
"class": "testing",
"id": 2,
"leaf": true,
"text": "Child 2"
},
{
"class": "testing",
"id": 1,
"leaf": true,
"text": "Child 3"
}
]
}
],
"instanceTotal": 1,
"success": true
}
I changed "children" for "instanceList" and my treepanel stopped doing that infinitely loop, so I guess If you change "name" for "children" ?
Setting data item to:
{
...
leaf: true
}
will stop it.
Loading trees can be tricking. Try setting loaded: true on those nodes. Before you start clicking around, is the tree properly loaded?
Make sure all parents that do not have any children have "leaf" set to "true" OR
have an empty "children" node.
AND all children nodes have "leaf" set to "true" (as already mentioned by Asken)
it seems to me that any child becomes a root to its dependents . So the root property and the children property MUST have the same NAME. I am very happy I found this tread. It saved my life I was about to shoot myself because of endless reloading the tree
As Edd said, if you set in proxy custom rootProperty:'instanceList', you have to change all "children" in json to that property, ie 'instanceList'. It was my solution.