Skip to content

Commit c1a898e

Browse files
committed
Fixed scope for column
Signed-off-by: Dmitry Mazurov <[email protected]>
1 parent ce32e15 commit c1a898e

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

src/VdtnetTable.vue

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,8 @@ export default {
309309
col.classFooterName = field.classFooterName
310310
}
311311
312-
if (field.render) {
313-
if (!field.render.templated) {
314-
let myRender = field.render
315-
field.render = function() {
316-
return myRender.apply(that, Array.prototype.slice.call(arguments))
317-
}
318-
}
319-
320-
col.render = field.render
312+
if (field.template) {
313+
col.template = field.template
321314
}
322315
323316
// console.log(col)
@@ -378,7 +371,7 @@ export default {
378371
if (startCol > 0) {
379372
if (that.options.order) {
380373
that.options.order.forEach((v) => {
381-
v[0] += startCol
374+
v[0] += startCol
382375
})
383376
} else {
384377
that.options.order = [[startCol, 'asc']]
@@ -389,6 +382,28 @@ export default {
389382
const that = this
390383
const jq = that.jq
391384
const $el = jq(that.$refs.table)
385+
let cols = that.options.columns
386+
387+
for (let k in cols) {
388+
const col = cols[k]
389+
390+
if (col.template || that.$scopedSlots[col.name]) {
391+
col.render = that.compileTemplate(col, that.$scopedSlots[col.name])
392+
}
393+
394+
if (col.render) {
395+
if (!col.render.templated) {
396+
let myRender = col.render
397+
col.render = function() {
398+
return myRender.apply(that, Array.prototype.slice.call(arguments))
399+
}
400+
}
401+
}
402+
403+
if (col.template) {
404+
delete col.template
405+
}
406+
}
392407
393408
// handle local data loader
394409
if (that.dataLoader) {

0 commit comments

Comments
 (0)