Skip to content

How to make changes to the widget definitions at runtime? #16

@ryanhz

Description

@ryanhz

How to make changes to the widget definitions at runtime, like this ?
I want to change the title when user change language.

var widgetDefinitions = [
    {
        name: 'wt-line-chart', 
        title: $scope.translation.income,
        attrs: { chart: 'chart' },
        size: { 
            width: '50%', 
            height: '300px' 
        },
        enableVerticalResize: true
    },
    {
        name: 'wt-pie-chart',
        title: $scope.translation.performance,
        attrs: {
            data: 'pieChartData'
        },
        size: {
            width: '50%', 
            height: '300px' 
        },
        enableVerticalResize: true
    }
];

var defaultWidgets = _.map(widgetDefinitions, function (a) {
    return {name: a.name};
});

$scope.dashboardOptions = {
    widgetDefinitions: widgetDefinitions,
    defaultWidgets: defaultWidgets,
    hideToolbar: true,
    hideWidgetName: true,
    hideWidgetSettings: true
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions