We'd love to hear from you! Provide  feedback  to earn a badge today. Take our quick survey
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Accessing Controller Data in Logic.js?

Accepted answer
32
Views
1
Comments
edited Mar 8, 2019 10:02AM in Customer Portal 1 comment

Content

Please see code below - my question is how to access data from a controller in the logic.js file

I have tried reading some other topics on the subject but can't get it to work

Code Snippet

CONTROLLER

<?php
namespace Custom\Widgets\forms;

class widebanding_edit extends \RightNow\Libraries\Widget\Base {
    function __construct($attrs) {
        parent::__construct($attrs);
    }

    function getData() {

        $ci = get_instance();
	$data['js']['foo'] = 'bar';
		
    }
}
?>

LOGIC.JS

RightNow.namespace('Custom.Widgets.forms.widebanding_edit');
Custom.Widgets.forms.widebanding_edit = RightNow.Widgets.extend({ 
    constructor: function() {
		
		console.log(data.js.foo);
		console.log(data);

    }
});

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!