Ask your Symfony questions! Pay money and get answers fast! (more info)

Paginate embedded forms Symfony

  • SOLVED

I know you can easily paginate objects/results using the pager class..but is there a way to apply this logic to embedded forms? If I have 100 embedded forms it would be nice to be able to paginate them in some way (Id prob end up doing it via ajax as you scroll down the page = it loads the next set of forms) but first step is figuring out how to split them up with a pager object

Ideas?

Answers (3)

2011-11-04

Milena Dimitrova answers:

Why don't you use a normal pager (sfPropelPager or sfDoctrinePager) iterating the form objects and implement an ajax form for each object (on every row)?

You will achieve something like an 'editable grid' in this way (see the attachment). Is this close to what you want to achieve?

2011-11-02

Luis Cordova answers:

yes there is a bundle for this https://github.com/craue/CraueFormFlowBundle


leftrock comments:

This is a symfony 1.4 project with doctrine


Luis Cordova comments:

oh no that sucks, you should check the symfony1.4 docu online, it has a study on that

2011-11-02

Amer Trkić answers:

You have psPageableFormPlugin for this:
http://www.symfony-project.org/plugins/psPageableFormPlugin

Its easy to use...


leftrock comments:

Hmmm...it sees like thats more helpful when you want to separate forms into pages right..so if there is a login form then a profile form..you can separate the login form into page one and the login into page 2....but what if there are a "100" login forms...I actually want to paginate those (they aren't different form objects)


Amer Trkić comments:

You can configure these 100 logins form in your pageable form, for examle in MyPageableForm write logic that handle and add your 100 forms by $this->addForm();
Also you can write this login in action.class, you can dynamically add forms ...

In template you can easy create pager when you have MyPageableForm object.
You have methods that can help you to create pager:
- getNumberOfForms
- setCurrentPageNumber
- getCurrentForm

Sorry for my bad english :(