Request new features or modifications


Post by vadim_g »

Hi guys,

We’ve noticed that AjaxStore fires load or loadPage depending on pageSize.
In most cases, we only need a single, generic load event to know when data has been fetched—regardless of paging.

In our large enterprise app, we’ve never needed to distinguish between paged and non-paged loads. Triggering load in all cases would be simpler, less confusing (especially when calling store.load()), more predictable, and consistent with Ext JS.

Otherwise we need to listen for both events and that would make the app more bloated and the tests bigger than needed, and we have hundreds of tests that listen for store load event.

		const store = new AjaxStore(CountriesStore);

		store.on({
			load() {
                             // Fired when pageSize: 0
			},
			loadPage() {
                            // Fired when pageSize > 0
			},
		});

		store.load();

Post by tasnim »

Hi,

I understand your concern about having to listen to both load and loadPage events when using an AjaxStore. Unfortunately, the current design distinguishes between these events to provide more granular control over paged and non-paged data loading scenarios.

However, you can simplify your event handling by creating a wrapper function that listens to both events and triggers a single callback. Here's a quick example:

const store = new AjaxStore(...);

function onDataLoad() {
    // Handle data load
}

store.on({
    load: onDataLoad,
    loadPage: onDataLoad
});

store.load();

This way, you can maintain a single point of handling for both events without having to duplicate logic in your tests or application code.

Does that help?

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by vadim_g »

Hi tasnim,

Your solution works for a single use case, but in real-world enterprise apps like ours, we have hundreds of load listeners in different configurations. Also most of the test specs don’t need that level of granularity. Achieving the desired behavior would require a global override, which isn’t optimal.

Some Bryntum components may expect load only for non-paged data, but with an override it would fire regardless—so it’s not a simple change.

We’re looking for an optimal solution: a single, generic store event (ideally load) that fires regardless of paging. Worst case, of course we’ll override with genericLoad, but we believe having this built-in would be far better.

Vadim


Post by tasnim »

I've opened a feature request ticket for it here https://github.com/bryntum/support/issues/11759. You can subscribe to the ticket so you'll be notified of any updates :)

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by vadim_g »

Thank you.


Post Reply