Datatable subView behaviour

Hi,

Currently, I have a datatable and each row contains another datable inside a subview.

I populate the subView dts via ajax using the onSubViewCreate event. This normally works well but when I try to expand all rows at once (using eachRow and openSub methods), some subviews appear as blank, randomly.

I tried to workaround this by loading all the subView data when the main datable is created/loaded, but I was unable to since it seems that I can’t get a subView via getSubView if that subview is closed (it always returns null unless the subView is actually expanded at the time getSubView is called).

I could expand each row individually, load the data into the subview by ajax and close the row again, but this would look awful for the user, since he would notice the rows expanding and closing (server response time before closing and whatnot).

Are any of these behaviours bugs? If so, any workaround? If not, any suggestions?

Hi, could you please tell how many rows are there in your datatable?

Anyway, I agree that many Ajax requests at a time will slow down the application, but it’s not a normal practice, isn’t?

So if you want to load all the data at once it will be better to push it to the client by one request. It can be done by

The number of rows are the number of users in the client’s system. Could be anywhere from 1 to hundreds. In my current case, it’s about 15.

The first example you link is the exact same implementation I have on my side.

The idea to load the subdata at the same time as the main idea is good, but the way our ajax request are handled, we can only get a single subdata at a time. Meaning if I want to open 5 subviews, 5 requests need to be sent and handled.

Maybe we need to restructure the request logic for this bit. However, this still does not explain why some subviews appear blank when opening all subviews.

However, this still does not explain why some subviews appear blank when opening all subviews.

Probably, the requests that fetch their data are still in progress and have not responded.

I’ve checked the requests with chrome’s dev tools network inspector and all requests have responded.

And what about the data? Did the data came and its format is right?

I tried to reproduce the issue locally, but all 15 subgrids are filled. But 200+ requests resulted into an unresponsive script, that’s why I advised you to change server side logic to avoid excessive communication with the server.

I can confirm that the data is coming back formatted properly, with a response time consistent with the amount of data returning. The inconsistency of the blank subviews does in fact make me believe it’s some sort of latency issue.

So is my only option to have all data loaded simultaneously? Absolutely no way to edit/parse/load a subview unless is it opened?

Btw, it you open and close blank subviews, will the data appear?

As to your question, yes, it is impossible to do any operations until it is opened as before it the subview does not exist.

If I open and close, it’s still blank. Since the subview is populated onSubViewCreated, it makes sense. Maybe it’s breaking when trying to create multiple subviews at the same time, since multiple requests will respond at different times.

If you have some kind of a sample where the problem can be reconstructed, please share a link. While loading data for multiple subgrids can be slow, it must not break in any case.

Could be anywhere from 1 to hundreds.

our ajax request are handled, we can only get a single subdata at a time

It can lead to a pretty nasty situation when a client will issue hundreads of ajax calls.

Yeah, we reworked the server call because of this. It is now a single request and the subviews are working properly. Thank you for the help.