Lines 34-87
export default {
Link Here
|
34 |
let table_id = this.table_id |
34 |
let table_id = this.table_id |
35 |
|
35 |
|
36 |
$("#" + table_id).kohaTable({ |
36 |
$("#" + table_id).kohaTable({ |
37 |
data: resources, |
37 |
data: resources, |
38 |
embed: ["package.name"], |
38 |
embed: ["package.name"], |
39 |
order: [[0, "asc"]], |
39 |
order: [[0, "asc"]], |
40 |
autoWidth: false, |
40 |
autoWidth: false, |
41 |
columns: [ |
41 |
columns: [ |
42 |
{ |
42 |
{ |
43 |
title: __("Name"), |
43 |
title: __("Name"), |
44 |
data: "package.name", |
44 |
data: "package.name", |
45 |
searchable: true, |
45 |
searchable: true, |
46 |
orderable: true, |
46 |
orderable: true, |
47 |
render: function (data, type, row, meta) { |
47 |
render: function (data, type, row, meta) { |
48 |
// Rendering done in drawCallback |
48 |
// Rendering done in drawCallback |
49 |
return "" |
49 |
return "" |
50 |
}, |
|
|
51 |
width: "100%", |
52 |
}, |
50 |
}, |
53 |
], |
51 |
width: "100%", |
54 |
drawCallback: function (settings) { |
52 |
}, |
55 |
var api = new $.fn.dataTable.Api(settings) |
53 |
], |
|
|
54 |
drawCallback: function (settings) { |
55 |
var api = new $.fn.dataTable.Api(settings) |
56 |
|
56 |
|
57 |
$.each( |
57 |
$.each( |
58 |
$(this).find("tbody tr td:first-child"), |
58 |
$(this).find("tbody tr td:first-child"), |
59 |
function (index, e) { |
59 |
function (index, e) { |
60 |
let tr = $(this).parent() |
60 |
let tr = $(this).parent() |
61 |
let row = api.row(tr).data() |
61 |
let row = api.row(tr).data() |
62 |
if (!row) return // Happen if the table is empty |
62 |
if (!row) return // Happen if the table is empty |
63 |
let { href } = router.resolve({ |
63 |
let { href } = router.resolve({ |
64 |
name: "EHoldingsLocalResourcesShow", |
64 |
name: "EHoldingsLocalResourcesShow", |
65 |
params: { resource_id: row.resource_id }, |
65 |
params: { resource_id: row.resource_id }, |
66 |
}) |
66 |
}) |
67 |
let n = createVNode( |
67 |
let n = createVNode( |
68 |
"a", |
68 |
"a", |
69 |
{ |
69 |
{ |
70 |
role: "button", |
70 |
role: "button", |
71 |
href, |
71 |
href, |
72 |
onClick: e => { |
72 |
onClick: e => { |
73 |
e.preventDefault() |
73 |
e.preventDefault() |
74 |
show_resource(row.resource_id) |
74 |
show_resource(row.resource_id) |
75 |
}, |
|
|
76 |
}, |
75 |
}, |
77 |
`${row.package.name}` |
76 |
}, |
78 |
) |
77 |
`${row.package.name}` |
79 |
render(n, e) |
78 |
) |
80 |
} |
79 |
render(n, e) |
81 |
) |
80 |
} |
82 |
}, |
81 |
) |
83 |
}) |
82 |
}, |
84 |
) |
83 |
}) |
85 |
}, |
84 |
}, |
86 |
}, |
85 |
}, |
87 |
mounted() { |
86 |
mounted() { |
88 |
- |
|
|