Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show all table rows on first page load when using reloadCallback #205

Open
chrisvel opened this issue Jan 14, 2016 · 11 comments
Open

Show all table rows on first page load when using reloadCallback #205

chrisvel opened this issue Jan 14, 2016 · 11 comments
Assignees
Milestone

Comments

@chrisvel
Copy link

In your example http://zizzamia.com/ng-tasty/directive/table-server-side/reload you can reload the table when the reloadCallback is called. But when the table is initially displayed, the object isn't fetched with a GET request, but only with the reloadCallback. How can I trigger the table load on initial page display ?

@pgouv
Copy link

pgouv commented Jan 14, 2016

Call search() maybe ?
Rotary

@chrisvel
Copy link
Author

search() isn't mandatory, I am calling $scope.reloadCallback(); from another function. Somehow bind-reload overrides bind-resource-callback when declared in <table> tag.

@Zizzamia
Copy link
Owner

The purpuse of the reload callback, it's to have the full control of when the table should be loaded.
http://zizzamia.com/ng-tasty/directive/table-server-side/reload

@chrisvel just for better understanding, your error happen only when you declare everything in the <table> tag?
If you do it as show in the documentation should work?

If it is the case, I have to investigate to understand what is the bug.
Thanks

@Zizzamia Zizzamia added this to the Version 0.6.2 milestone Jan 14, 2016
@chrisvel
Copy link
Author

@Zizzamia yes like your example. I don't think it's a bug, there might be a workaround. Imagine listing a table with all elements and then try to filter the main object in order to exclude some. The way it works now is that it shows nothing until a GET request is trigger when the callback is called.

@chrisvel
Copy link
Author

@Zizzamia I found a workaround but I am not sure how much safe it is.

var callInit = function() {
      $scope.reloadCallback();
    }

angular.element(document).ready(callInit);

Please advice and If you agree you could add it to the documentation.

EDIT: This works only on page load and not when moving between pages. Logically,

var callInit = function() {
      $scope.reloadCallback();
    }

callInit();

should be enough but it doesn't work. Any help will be greatly appreciated because I am using it in a big project right now and have been stuck for several days.

@piyushpatil027
Copy link

Hi Zizzamia ,

Hope you are doing great.I am using (http://zizzamia.com/ng-tasty/directive/table-server-side/reload ) library. When the table is initially displayed, the object isn't fetched with a GET request, but only with the reloadCallback. How can I trigger the table load on initial page display ?

I am getting same problem in my code.How can this problem sovle?

@masoodtrb
Copy link

@piyushpatil027 +1

@newbro
Copy link

newbro commented Feb 16, 2016

I am also facing this problem. Actually the default bind-resource-callback + bind-filters already serve my needs (I too wish to load up all rows in table onload, and add filtering options on UI). However I spot there are some minor issues with the way it watches filter variable (debouncing problem?) which results in inconsistent search data so I end up using bind-reload so I can limit the ajax call. I am pretty much done, except I need a way to load all the data into the table on page load unlike the example.

BTW thanks for the work on this, seems to be a much cleaner solution than using the angular-datatable hack.

[UPDATE]
Just found out I can actually override the default tableConfig constant by using bind-theme (the naming doesn't really help here just my opinion)

so using bind-theme="customTheme" and $scope.customTheme = { loadOnInit:true } was able to solve my problem.

@olegderecha
Copy link

so using bind-theme="customTheme" and $scope.customTheme = { loadOnInit:true } was able to solve my problem.

Excellent, thank you!
I set bind-theme="{loadOnInit: true}" in markup.

@HesyRa
Copy link

HesyRa commented Apr 21, 2016

I set bind-theme="{loadOnInit: true}" in markup.

Ty, also worked for me!! gj

@Zizzamia
Copy link
Owner

Zizzamia commented May 10, 2016

Sorry guys, had very intense 6 months with Plan (https://getplan.co), spending most of my time with Angular 2 recently.

Here guys the documentation about bind-theme http://zizzamia.com/ng-tasty/directive/table/custom-theme, you can override several default property.

Also @newbro, what name you suggest? Open to any suggestion :)

@Zizzamia Zizzamia self-assigned this May 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants