tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/316-best-practice-for-creating-a-reusable-component-and-mediator-that-is-clean-question-about-my-pagination-conceptRobotlegs: Discussion 2018-10-18T16:35:18Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/32851602010-10-09T07:48:54Z2010-10-09T09:04:47ZBest practice for creating a reusable component and mediator that is clean (question about my pagination concept)<div><p>Hi rickcr,</p>
<p>Probably not exactly what you need, but it may at least inspire you:</p>
<p><a href="http://github.com/Matan/HandBones">http://github.com/Matan/HandBones</a></p>
<p>Take a look at: Handle NavigatorEvent.PAGE_CHANGE event<br />
from<br />
<a href="http://github.com/Matan/HandBones/wiki/Getting-Started">http://github.com/Matan/HandBones/wiki/Getting-Started</a></p>
<p><a href="http://github.com/Matan/HandBones-Samples">http://github.com/Matan/HandBones-Samples</a></p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/32851602010-10-09T18:43:21Z2010-10-09T18:43:21ZBest practice for creating a reusable component and mediator that is clean (question about my pagination concept)<div><p>What I opted to do is keep the PaginationMediator even more generic - when a pagination event takes place on the component it dispatches a PaginationEvent.FETCH_RECORDS event, but the key is that it passes along a "listName" attribute that is set when the component is first created. So if working with cars, on the cars main view where you are using the pagination component, you pass in a PAGINATION_CARS constant string.</p>
<p>This way you can have mediators for the the main pages like the cars page listen for a pagination event, but it has to check the listName first (eg it checks the paginationEvent has in it "PAGINATION_CARS") and if so it then dispatches to fetch the appropriate records passing along any pagination info.</p>
<p>Maybe not a perfect solution but it keeps things generic enough.</p></div>rickcr