Commit 8a9cf44d authored by tabacoWang's avatar tabacoWang
Browse files

feat: combine with search result

parent 872ea83c
......@@ -73,7 +73,17 @@
loaded = true;
});
$: paginatedSource = users.slice(
$: paginatedSource = users
.filter((user) => {
if (search === '') {
return true;
} else {
let name = user.name.toLowerCase();
const query = search.toLowerCase();
return name.includes(query);
}
})
.slice(
paginatorSettings.page * paginatorSettings.limit,
paginatorSettings.page * paginatorSettings.limit + paginatorSettings.limit
);
......@@ -174,15 +184,7 @@
</tr>
</thead>
<tbody>
{#each paginatedSource.filter((user) => {
if (search === '') {
return true;
} else {
let name = user.name.toLowerCase();
const query = search.toLowerCase();
return name.includes(query);
}
}) as user}
{#each paginatedSource as user}
<tr class="bg-white border-b dark:bg-gray-900 dark:border-gray-700 text-xs">
<td class="px-3 py-2 min-w-[7rem] w-28">
<button
......@@ -280,12 +282,13 @@
{/each}
</tbody>
</table>
<Paginator bind:settings={paginatorSettings} showNumerals />
</div>
<div class=" text-gray-500 text-xs mt-2 text-right">
ⓘ {$i18n.t("Click on the user role button to change a user's role.")}
</div>
<Paginator bind:settings={paginatorSettings} showNumerals />
</div>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment