Good day! Is there a way to inject a sublist in a ...
# suitescript
g
Good day! Is there a way to inject a sublist in a subtab in Suitelet upon clicking on the subtab? The background is that I have a Suitelet with half a dozen sublists and loading the Suitelet takes a dozen seconds. I was thinking of moving the list content into subtabs and when a user clicks on a subtab, the sublist gets loaded then.
a
you'd have to have a click event handler on the subtab, not sure how easy that would be, the better approach is probably just to have a custom button on the subtab (i think that's a thing?) and have you click event handler on that to load your sublist data
g
Thank you for the suggestion. How to load the sublist data? I understand there is a new Single Page Applicatio Framework in beta for specific partners. In the meantime, though, would the sublist data need to be queried via a client script call into a dedicated Suitelet and then returned to the client script? Is there any way to leverage on N/form functions to inject into an existing fully rendered Suitelet page?
a
not sure I understand what you're asking about N/form i thought the whole point was to do it on demand? if you can preload all the data at pageload isn't that what you have already? and yeah client script function to call a backend suitelet to get the data back, but only when they ask for it
g
I simply thought of N/form because I wouldn't know any other way to render the sublist in the Netsuite format. Indeed, I would like to do it when the page is already rendered, triggered by a client script, but what functions in the SuiteScript stack can I leverage on to inject a sublist or new sublist lines at this point?
a
hmm yeah this is more involved than I was assuming.
just speculating, can you maybe use a URL parameter
&sublist=mysublist
and then in the suitelet conditionally load that active sublist data? rather than ALL the sublists? it would still be a full page refresh... which is slower, but not all the sublists data? and you'd be able to have the sublist data load appropriately in the subtab or whatever ui elements you're using.
that might be easier than trying to figure out async loading and injecting