Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
rmnvncnt
Partner - Contributor II
Partner - Contributor II

Enigma.js : No "change" event on a bookmark add/deletion

Hi,

I am integrating Qlik Sense using enigma.js and following the related tutorial. This is my code currently :

 

  // Get bookmarks
  const bookmarkListModel = await app
    .createSessionObject({
      qInfo: { qId: "BookmarkList", qType: "BookmarkList" },
      qBookmarkListDef: { qType: "bookmark" }
    })
    .catch(errorHandler);
​
  const bookmarksUpdater = () =>
    bookmarkListModel
      .getLayout()
      .then(layout => (qlikApi.app.bookmarks = layout.qBookmarkList.qItems))
      .catch(errorHandler);
​
  // Reactive bookmarks
  bookmarkListModel.on("changed", bookmarksUpdater);
  await bookmarksUpdater();

 

 

The first call to the await bookmarksUpdater();  updates correctly my qlikApi.app.bookmarks variable, however deleting/adding bookmarks does not trigger the event.

I tried :

  • Putting console.log everywhere. The bookmarksUpdater function is never called after the first time.
  • Requesting some qData in the qInfo of the bookmarkListModel. No change.
  • Using all the other events. None is triggered.

Do you have any clue on where to search next?

Labels (2)
2 Replies
alex_colombo
Employee
Employee

Hi @rmnvncnt , I tested your code and it works on my side. You are managing it in the correct way reacting to changes on your bookmarks list.

//----- React to bookmarks list changes -----
//Create bookmark list
const bookmarkListModel = await app
  .createSessionObject({
    qInfo: { qId: "BookmarkList", qType: "BookmarkList" },
    qBookmarkListDef: { qType: "bookmark" }
})

const bookmarksUpdater = () =>
  bookmarkListModel
    .getLayout()
    .then(layout => console.log("a"))
  
// Reactive bookmarks
bookmarkListModel.on("changed", bookmarksUpdater);
await bookmarksUpdater();

//Create a bookmark
const bookmarkDef = {
  "qInfo": {
      "qType": "bookmark"
  },
  "qMetaDef": {
      "title": "Bookmark (1)",
      "description": "",
      "isExtended": false
  },
  "creationDate": "2023-03-15T09:21:38.845Z",
  "sheetId": "bd37d32a-20c4-47e6-aeea-0838e98e1de2",
  "selectionFields": "Date"
}
const bookmarks = await app.createBookmark(bookmarkDef);
//Delete bookmark
await app.destroyBookmark(bookmarks.id);

 

rmnvncnt
Partner - Contributor II
Partner - Contributor II
Author

Hi alex_colombo,

Thank you for testing. We managed to fix this issue.
For posterity, the issue was on the user session : we did not open a websocket session specifically for the app, we simply opened it for the engine and then re-used it for the app.

Link that helped us : https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-server-stuck-at-SESSION-ATTACHED-stage...

Best regards