cancel
Showing results for 
Search instead for 
Did you mean: 

While saving Fragment Bookmarks in Design Studio, what should be given in container parameter ?

0 Kudos

When we save Fragment Bookmark in design studio, we need to give a container parameter. My question is that how do we decide this parameter.

I have given the Panel as container for my dashboard , so when I save my bookmark it gets saved. But when I load the same bookmark it does not load. I think the problem is with the container parameter.

Kindly help me to know the use of this parameter.

Accepted Solutions (0)

Answers (3)

Answers (3)

howsy
Explorer
0 Kudos

Hi Sawan,

I suggest to store the Panel where either your crosstab/chart is located in, or your filterpanel.

In my example I have a Crosstab, located in "PANEL_1" (white Background)
and a Dimension Filter in "PANEL_2" (gray background)

When hitting "save" it makes no difference, whether you store 1 or 2, as both are related to the same datasource.

However: I was facing issues with my already saved bookmarks, when changing the container, which I have used as bookmark-source. So I always store the container where the filterpanel is located in, because this is in my view the container, which will be changed the less.

Skript for Save:
//saving the gray container
Bookmark.FragmentBookmark.saveBookmark(PANEL_2);


Skript for getting all boomarks:
var all = Bookmark.FragmentBookmark.getAllBookmarkInfos(); all.forEach(function(element, index) { LISTBOX_1.addItem(element.id, element.id); });


Skript for loading the selected bookmark from the list:
var id = LISTBOX_1.getSelectedValue(); Bookmark.FragmentBookmark.loadBookmark(id);



Regards,
Chris

0 Kudos

Hi Mustafa,

Thanks for your response.

Below is the script that I am using for saving, Loading and deleting Bookmarks.

Saving:

var bookmarkname = INPUTFIELD_2.getValue();

if (bookmarkname == "")

{

APPLICATION.alert("Please Enter Bookmark Name");

}

else

{

if (Bookmark.bookmarkWithTitleExists(bookmarkname))

{

APPLICATION.alert("Bookmark name already exists");

}

else

{

Bookmark.FragmentBookmark.saveBookmark(PANEL_1,bookmarkname);

var bookmarks = Bookmark.FragmentBookmark.getAllBookmarkInfos();

bookmarks.forEach(function(element, index)

{

LISTBOX_2.addItem(element.id, element.title);

});

INPUTFIELD_2.setValue("");

}

}

Loading:

var id = LISTBOX_2.getSelectedValue();

Bookmark.FragmentBookmark.loadBookmark(id);

var bookmarks = Bookmark.FragmentBookmark.getAllBookmarkInfos();

bookmarks.forEach(function(element, index)

{

LISTBOX_2.addItem(element.id, element.title);

});

Deleting :

Bookmark.FragmentBookmark.deleteBookmark(LISTBOX_2.getSelectedValue());

INPUTFIELD_2.setValue("");

LISTBOX_2.removeAllItems();

LISTBOX_2.addItem("1", "Select Bookmark",0);

var array = Bookmark.FragmentBookmark.getAllBookmarkInfos();

array.forEach(function(element, index)

{ LISTBOX_2.addItem(element.id, element.title);

});

MustafaBensan
Active Contributor
0 Kudos

Hi Sawan,

When using portable fragment bookmarks, as a best practice, the container component should only include the visual content that you wish to bookmark the state of. It should not include the "administrative" components that take care of the bookmark processing such as saving, loading and deleting.

Looking at your example, the PANEL_1 component used as the container for your fragment bookmark includes only administrative components (buttons, list boxes, input field etc) but no "real" content such as a chart. You need to restructure your application accordingly, such that PANEL_1 only contains visual content and move the administrative components outside PANEL_1.

The approach I have described above is effectively the approach implemented in the example Christian has posted in his answer, although I prefer not to include filter components in bookmark containers.

Regards,

Mustafa.

MustafaBensan
Active Contributor
0 Kudos

Hi Sawan,

For a Fragment Bookmark, the Panel component is the generally recommended one as the container, however you can use any of the valid container types. I suspect your issue is related to how you are loading the Fragment Bookmark rather than the choice of container. In order to provide you with further guidance it would be helpful if you posted the following:

1) Screenshots of your application layout, highlighting the panel;

2) Script code for saving and loading the fragment bookmark.

Regards,

Mustafa.

0 Kudos

Hi Mustafa,

Thanks for your response.

Below is the script that I am using for saving, Loading and deleting Bookmarks.

Saving:

var bookmarkname = INPUTFIELD_2.getValue();

if (bookmarkname == "")

{

APPLICATION.alert("Please Enter Bookmark Name");

}

else

{

if (Bookmark.bookmarkWithTitleExists(bookmarkname))

{

APPLICATION.alert("Bookmark name already exists");

}

else

{

Bookmark.FragmentBookmark.saveBookmark(PANEL_1,bookmarkname);

var bookmarks = Bookmark.FragmentBookmark.getAllBookmarkInfos();

bookmarks.forEach(function(element, index)

{

LISTBOX_2.addItem(element.id, element.title);

});

INPUTFIELD_2.setValue("");

}

}

Loading:

var id = LISTBOX_2.getSelectedValue();

Bookmark.FragmentBookmark.loadBookmark(id);

var bookmarks = Bookmark.FragmentBookmark.getAllBookmarkInfos();

bookmarks.forEach(function(element, index)

{

LISTBOX_2.addItem(element.id, element.title);

});

Deleting :

Bookmark.FragmentBookmark.deleteBookmark(LISTBOX_2.getSelectedValue());

INPUTFIELD_2.setValue("");

LISTBOX_2.removeAllItems();

LISTBOX_2.addItem("1", "Select Bookmark",0);

var array = Bookmark.FragmentBookmark.getAllBookmarkInfos();

array.forEach(function(element, index)

{ LISTBOX_2.addItem(element.id, element.title);

});