0
私はユーザのテーブルを持っています。私はそれらを 'グループ'でフィルタリングできる必要があります。ユーザーがドロップダウンリストからオプションを選択したのでとき、私は、ページ全体だけユーザーテーブルは、そのグループからリロードして表示ユーザーしないようにしたい選択変更後のsymfonyリロードテーブル
これは、ユーザーテーブル
Filter by group
<select class="filter-users">
<option selected></option>
{% for group in groups %}
<option>{{ group.name }}</option>
{% endfor %}
</select>
<table id="dataTable">
<tbody>
{% for user in users %}
<tr>
<td>{{user.id}}</td>
<td>{{user.fullName}}</td>
</tr>
{% endfor %}
</tbody>
</table>
取得するには、このアクションの小枝グループ名でユーザーを表示する
/**
* @Route("/filter", name="users_filter")
*/
public function filterAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$group = $request->request->get('group');
$users = $em->getRepository('AppBundle:User')->findBy(['group' => group]);
return $this->render('AppBundle:User:list.html.twig', [
'users' => $users
]);
}
[リダイレクトの可能性のある複製を作成選択ドロップダウンリストから項目を選択すると自動的に](https://stackoverflow.com/questions/580281/redirect-automatically-when-selecting-an-item-from-a-select-drop-down-list) –
@TobiasXyページの特定の部分だけをリロードする必要があります。リダイレクトではありません – julie