Skip to content

Commit 8ef83fe

Browse files
authored
Merge pull request #1 from sietzekeuning/patch-1
add click event on row
2 parents 8cbf427 + e628bb9 commit 8ef83fe

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

js/Components/Table.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
'hover:bg-gray-100': striped,
154154
'hover:bg-gray-50': !striped
155155
}"
156+
@click="rowClick(item, key)"
156157
>
157158
<td
158159
v-for="column in queryBuilderProps.columns"
@@ -291,6 +292,8 @@ const props = defineProps({
291292
}
292293
});
293294
295+
const emit = defineEmits(["rowClick"]);
296+
294297
provide("activeClasses", props.activeClasses);
295298
296299
const app = getCurrentInstance();
@@ -387,7 +390,9 @@ const hasData = computed(() => {
387390
return false;
388391
});
389392
390-
//
393+
function rowClick(item, key) {
394+
emit("rowClick", item, key);
395+
}
391396
392397
function disableSearchInput(key) {
393398
forcedVisibleSearchInputs.value = forcedVisibleSearchInputs.value.filter((search) => search != key);

js/Components/TableActiveFilters.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
clip-rule="evenodd"
1414
/>
1515
</svg>
16-
<span class="text-gray-400 ml-1">{{ numFilters }} active <span v-text="numFilters === 1 ? 'filter' : 'filters'"></span>:</span>
16+
<span class="text-gray-400 ml-1">{{ numFilters }} active <span v-text="numFilters === 1 ? 'filter' : 'filters'" />:</span>
1717
</div>
1818

1919
<button

php/InertiaTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Illuminate\Pagination\Paginator;
77
use Illuminate\Support\Collection;
88
use Illuminate\Support\Str;
9-
use Inertia\Response;
109
use Illuminate\Support\Traits\Conditionable;
10+
use Inertia\Response;
1111

1212
class InertiaTable
1313
{

0 commit comments

Comments
 (0)