cancel
Showing results for 
Search instead for 
Did you mean: 

Opening and closing the same Popup component in Design Studio 1.6.4 to display different charts

Former Member
0 Kudos

Hi,

I am trying to use the same Pop up to display a chart component for which i dynamically change the data selection in the script based on the user selection.

The pop up works fine when it opens the first time but when i close the Pop up (using the close() function) the next pop up behavior is impacted. The chart displays an error "Attach a data source" when the other pop up is opened.

Although, if i close and re-open the pop up again i see the chart correctly. After closure, the same pop-up needs to be opened twice to display data correctly. Please let me know if there is something i am doing incorrectly.

Below are the screenshots of a demo application -

1. The application has two buttons, which open a pop up containing a chart. One button is used to display US data and the other to display UK data in a chart.

2. Upon clicking the US Data button, the pop up is opened displaying the US chart.

3. After closing the previous pop-up and clicking on the UK data button, the following error is displayed.

4. Upon closing the above popup and re-clicking the UK data button, the chart is displayed correctly as shown below.

TammyPowlas
Active Contributor
0 Kudos

To clarify, are you using the POPUP component? Can you share the properties of your POPUP component? Could you change the Autoclose property to "true"?

MustafaBensan
Active Contributor
0 Kudos

Hi Saleh,

It would be helpful for tracking the issue if you could also provide the script code used in each of the 3 buttons: "US Data", "UK Data" and "Close popup".

Regards,

Mustafa.

Former Member
0 Kudos

Hi Mustafa,

Below are the scripts i have used for each of the buttons -

"US Data" button code -

INFOCHART_1.setDataSelection({"COUNTRY":"United States"});

POPUP_1.open();

"UK Data" button code -

INFOCHART_1.setDataSelection({"COUNTRY":"United Kingdom"});

POPUP_1.open();

"Close" button code -

POPUP_1.close();

Former Member
0 Kudos

Hi Tammy,

Please find below the properties of the Pop up. I haven't used auto-close as the user needs to be able to close the pop-up manually.

TammyPowlas
Active Contributor
0 Kudos

I'm on 1.6.4.1 and don't see the Animation property.

I know you said you want the user to close manually; when I set the Autoclose to true, the user can still close it manually by clicking outside the Popup box. What happens when you try that and remove the POPUP close line?

Former Member
0 Kudos

Hi Tammy,

I observed that the whole issue is due to the Close() function. If i click the US/UK buttons without invoking the Close() function no issue is observed.

As a workaround i instead implemented the functionality with a Panel setting its visibility to true/false and i don't face the error anymore but wondering if there is something i am missing with the Close() function.

Accepted Solutions (1)

Accepted Solutions (1)

MustafaBensan
Active Contributor

Hi Saleh,

Sorry about the late follow-up. I have been able to reproduce your issue. If you ask me, it's a bug. However, I have found that the following workaround resolves the issue. Update the code in your Close button to read as follows:

POPUP_1.close();
DS_1.reloadData();

Since there is no change in the underlying data, the reloadData() doesn't actually reload the data, so there is no performance hit but it resolves the "Attach a data source to component" error.

Regards,

Mustafa.

Former Member

Hi Mustafa,

Thanks for looking into this. The above solution resolves the issue.

Thanks,
Waleed

Answers (1)

Answers (1)

gertjan_oostrum
Explorer
0 Kudos

any update on this ? I am facing exact the same issue.

MustafaBensan
Active Contributor
0 Kudos

Hi Gert,

I just posted a suggested workaround. Hopefully it will resolve your issue as well.

Regards,

Mustafa.

Former Member
0 Kudos

Hi Gert,

The solution shared by Mustafa below works. Another way that I had used was that i used a Panel component and fashioned it similar to a popup using the setVisible(true) to show it when it is to be displayed and setVisible(false) when it has to be closed. Hope it helps.

Thanks,

Waleed