I’m trying to reproduce the official/demo JS Block example using ctx.openView() to open a detail drawer.
In the demo, it works like this:
const DETAIL_UID = 'slkoh867b93';
await ctx.openView(DETAIL_UID, {
filterByTk: row.id,
});
When clicking the card, the drawer opens correctly and shows the selected record.
In my case:
- I already copied the UID from the detail drawer
- I did NOT use the page UID
- but I’m still not sure if this is actually the correct place to get the UID from
My current test:
await ctx.openView('baf244b2c11', {
filterByTk: row.id,
});
but nothing opens.
My main questions are:
- Is the correct UID for
ctx.openView()really the UID from the detail drawer? - Is there a specific place in the builder/designer to copy the correct UID?
- Does
filterByTkalways need to use the internal NocoBase primary key? - Is there any way to debug
ctx.openView()? - Does the drawer need any special configuration to work with
openView()?
I also saw examples like:
const popupUid = `${ctx.model.uid}-detail`;
but in the demo the UID seems to be fixed/hardcoded.
Thanks!