im working on a symfony project and one of the things i have to implement is a list that updates its content reacting to the introduction of data in a filter.

The idea is that the user can search in a list using an apropiate symfony sfFilter of the class objects listed, and, without reloading the page (executing again the action or anotherone) the list show the results of its search.

How would you do it? Is there com jquery plugin or something like, to do that? Maybe an ajax function? if so, how to implement it?

Thank you very much for your time

有帮助吗?

解决方案

First you have to send the filters to the server. Probably detecting a field change with jquery function change(). Then you submit the filters form with:

$.post('new_action_to_filter', $('.sf_admin_filter form').serialize(), 
  function(data){
    $('.sf_admin_list').replaceWith(data);
  }
});

Then you copy the contents of executeFilter() to this new action and the executeIndex action too (a mix of both). Finally on your new action template you call the partial _list.php

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top