Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Chart Popup

$
0
0
Hello Paulson,

Looking through your code sample I must point out a few things;
1.) StackLayout does not have rows and cols  (those attributes are used with Grid Layout).. if you have a gridLayout as a parent then you can set rows and cols and then use rowand col to specify on which row and col in the GridLayout to have your inner element displayed. Notice the difference - declaring Grid's rows and cols VS declaring the place of the element within the grid with row nad col

2.) About your binding context.
- You are creating your binding context in two places and overriding it. That is not good practice and will also cause for you to lose the initial data after overwriting the context.

What you can do is called lazy loading - create your viewModel and reuse it in your page the following way.

"use strict";
var observable_1 = require("data/observable");
var viewModel = new observable_1.Observable();
 
viewModel.set("sliderFooter", "week2"); // initial value for your sliderFooter
 
function navigatingTo(args) {
    var page = args.object;
    page.bindingContext = viewModel;
}
exports.navigatingTo = navigatingTo;
 
function next(args) {
    // you don't have to get reference to your page here..
    // you don't have to create new context and overwirte the old one
    // just set the new value to the already defined property
    viewModel.set("sliderFooter", "week300");
}
exports.next = next;

<
Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
 
    <StackLayout>
      <Button text="" tap="prev" fontSize="22"  />
        <StackLayout>
          <Label text="{{sliderFooter}}" />
        </StackLayout>
      <Button text="" tap="next" />
    </StackLayout>
 
</Page>

Now that you have set your page binding context in navigatingTo (or other events such as loaded) just make sure have exported your methods and bind to the property and exported methods


Regards,
Nikolay Iliev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>