修改表格,等样式
This commit is contained in:
28
sf_sale/static/js/setTableWidth.js
Normal file
28
sf_sale/static/js/setTableWidth.js
Normal file
@@ -0,0 +1,28 @@
|
||||
function setTableWidth() {
|
||||
let timer = null
|
||||
const dom = $('.o_list_renderer ')
|
||||
if(!dom.length) {
|
||||
timer = setTimeout(setTableWidth, 500)
|
||||
return
|
||||
}
|
||||
const widthTest = '<span id="widthTest" style="width: fit-content"></span>'
|
||||
$('body').append(widthTest)
|
||||
clearTimeout(timer)
|
||||
const tbody_tr = dom.find('tbody').children('tr')
|
||||
dom.find('thead').children('tr').children().each(function () {
|
||||
$('#widthTest').text($(this).text())
|
||||
const width = $('#widthTest').width()
|
||||
const i = $(this).index()
|
||||
console.log(111)
|
||||
tbody_tr.each(function () {
|
||||
if($(this).children().length > 2) {
|
||||
$(this).children().eq(i).css('min-width', width + 'px')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setTableWidth()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user