Widget Help - Pass options for a widget from another widget

miriamberge
Tera Guru

I want to pass the table name to the "Data Table From Instance Definition" widget from another widget.

Essentially, I have two widgets on my page.  The first widget contains a list of table names.  When the user clicks on the table name, I want it to send the table name to the copy of Data Table From Instance Definition widget and load the table.

I have my first widget talking to the data table widget ie. in my client script I have:

$rootScope.$on('table', function(event,data) {
console.log('Listener caught Table: ' + $rootScope.table);
});

How do I pass that table name back to the server code as though that was an option selected on the data table from instance definition widget, so that it will load that table?  New to this...thanks in advance.

8 REPLIES 8

Allen Andreas
Administrator
Administrator

Hi,

So I'm sure you'll have to clone the Data Table from Instance Definition widget for use in this instance and if you have the other widget broadcasting that change and then on your clone data table widget you have that listener on, then "data" is what is carrying that table information.

In the cloned data table widget, it looks like you'd want to set: data.table_label to data from your listener.

You could try:

$rootScope.$on('table', function(event,data) {
$scope.data.table_label = data;
});

That's just me guessing, as I haven't cloned the data table from instance definition widget, but whatever is carrying over the table label, you'd want to set the scope for that widget to that label.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

It's been a bit since my reply was posted. I just wanted to check-in and see how things are going.

If my reply helped guide you correctly, please mark it as Helpful & Correct.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allan, I did mark your reply as helpful.  Thank you! This is what I put for the client script:

  $rootScope.$on('table', function(event,table){
   c.data.tablename = $rootScope.table;
  });

 

 

Great, thank you.

Did that reply help guide you correctly? If so, please mark as Correct.

Otherwise, let us know if you still need assistance as your question is left unanswered at this point.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!