Changes between Initial Version and Version 1 of SpinnerPaginated

Show
Ignore:
Timestamp:
01/28/09 13:09:43 (4 years ago)
Author:
alex94040
Comment:

Initial port from  http://wiki.qcodo.com/content/adding-a-qwaiticon-a-qpaginatedcontrol-such-a-qdatagrid

Legend:

Unmodified
Added
Removed
Modified
  • SpinnerPaginated

    v1 v1  
     1I wanted paging in my datagrid to display a spinner. Here's how I accomplished that:[[BR]][[BR]]1) '''QPaginatorBase'''[[BR]]Unfortunately, you have to alter QPaginatorBase in order to change the action config to use the !WaitIcon. The way I changed it, if added to core, will still allow it to behave normally until overridden with a child class.[[BR]][[BR]]Simply move the "Setup Pagination Events" section of code into its own "Setup" function, and ensure you call it from where the code used to reside.[[BR]][[BR]]'''important''': This includes both the !__construct() function, as well as the !UseAjax portion of !__set()[[BR]][[BR]]2) '''QPaginator'''[[BR]]Now that the action code is somewhere we can override it safely (before, in the constructor, there was no way to avoid it without also avoiding calling the grandparent constructor, which we needed), let's actually do so.[[BR]][[BR]]Create a !WaitIcon member of QPaginator, then, overriding Setup(), pass it in as part of the QAjaxControlAction.[[BR]]You'll also want to tweak the setter for !WaitIcon, so that it re-calls Setup, after doing a $this->!RemoveAllActions('onclick');[[BR]]This way, if a !WaitIcon is set at a later point, it still gets used on a click.[[BR]][[BR]]3) '''QDataGrid'''[[BR]]Now that changing pages can trigger a !WaitIcon, let's create one, and display it.[[BR]][[BR]]Create a !WaitIcon member of QDataGrid, create it in !__create, and Render it as part of the Get*HTML functions, wherever you want it to appear. (In my case, it's beside the filter button on my new QFilteredDataGrid, which will be released soon.)[[BR]][[BR]]Then, so that the paginator knows about this wait icon, override the !__set function in QDataGrid so that when a Paginator, or !PaginatorAlternate is set, you set the !WaitIcon on it to your !WaitIcon.[[BR]][[BR]]That's it! [[BR]](authored by !VexedPanda)