Hi,
I am trying to implement a custom js component (Redirecting…) on cuba, I have managed to make it show, however am stuck on how i can attach it to a collection datasource.
this is basically the bare implemenation:
First of all, I would recommend reading Using a JavaScript library to get an idea how to integrate a JavaScript component.
Then, I would recommend using Google Gson to serialize a datasource. You can do serialization every time the shared state and RPC invocations are sent to the client (in this case you need to use the beforeClientResponse method of the AbstractJavaScriptComponent implementation). For example:
public class Gannt extends AbstractJavaScriptComponent {
...
@Override
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
String dataJsonSting = serailizeDataSource();
getState().data = dataJsonSting;
}
...
}