@@ -139,7 +139,7 @@ function componentLine(name,columns,data) {
139
139
function selectTd ( td , type , value , column ) {
140
140
switch ( type ) {
141
141
case 'text' :
142
- td . innerHTML = ' <p style="text-overflow: ellipsis;overflow: hidden;display: block;white-space: nowrap;">'+ value + '</p>' ;
142
+ td . insertAdjacentHTML ( 'afterbegin' , ' <p style="text-overflow: ellipsis;overflow: hidden;display: block;white-space: nowrap;">'+ value + '</p>' ) ;
143
143
break ;
144
144
case 'input' :
145
145
let input = document . createElement ( 'input' ) ;
@@ -158,7 +158,7 @@ function componentLine(name,columns,data) {
158
158
td . appendChild ( input ) ;
159
159
break ;
160
160
default :
161
- td . innerHTML = ' <p style="text-overflow: ellipsis;overflow: hidden;display: block;white-space: nowrap;">'+ value + '</p>' ;
161
+ td . insertAdjacentHTML ( 'afterbegin' , ' <p style="text-overflow: ellipsis;overflow: hidden;display: block;white-space: nowrap;">'+ value + '</p>' ) ;
162
162
break ;
163
163
}
164
164
}
@@ -186,6 +186,7 @@ function componentLine(name,columns,data) {
186
186
}
187
187
/*head foot*/
188
188
var dom = document . getElementById ( name ) ;
189
+ dom . style = 'overflow-x: auto;' ;
189
190
var head = '<tr style="display:table;width:100%;table-layout:fixed;">' ;
190
191
var foot = head ;
191
192
for ( let column in columns ) {
@@ -195,19 +196,19 @@ function componentLine(name,columns,data) {
195
196
if ( columns [ column ] . style ) {
196
197
head += '<th style="' + columns [ column ] . style + '">' + columns [ column ] . name + '</th>' ;
197
198
foot += '<th style="' + columns [ column ] . style + '">' +
198
- '<input class="form-control" data-column="' + column + '" placeholder="添加 :' + columns [ column ] . name + '"/></th>' ;
199
+ '<input class="form-control" data-column="' + column + '" placeholder=":' + columns [ column ] . name + '"/></th>' ;
199
200
continue ;
200
201
}
201
202
head += '<th>' + columns [ column ] . name + '</th>' ;
202
203
foot += '<th>' +
203
- '<input class="form-control" data-column="' + column + '" placeholder="添加 :' + columns [ column ] . name + '"/></th>' ;
204
+ '<input class="form-control" data-column="' + column + '" placeholder=":' + columns [ column ] . name + '"/></th>' ;
204
205
}
205
206
head += '<th style="width: 30px"></th></tr>' ;
206
207
foot += '<th style="width: 30px" class="JsonTableInsert"></th></tr>' ;
207
208
208
- dom . insertAdjacentHTML ( 'afterbegin' , ' <style>#' + name + ' tbody::-webkit-scrollbar { width: 0 !important }</style>' +
209
- '<table class="table table-striped table-bordered table-hover table-responsive">' +
210
- '< thead>' + head + ' </thead></table>' ) ;
209
+ dom . insertAdjacentHTML ( 'afterbegin' , ` <style>#${ name } tbody::-webkit-scrollbar { width: 0 !important }
210
+ # ${ name } th,# ${ name } td{width: 100px}
211
+ </style><table class="table table-striped table-bordered table-hover table-responsive">< thead>${ head } </thead></table>` ) ;
211
212
/*hidden data container*/
212
213
var dataInput = document . createElement ( 'input' ) ;
213
214
dataInput . setAttribute ( 'name' , name ) ;
@@ -236,6 +237,11 @@ function componentLine(name,columns,data) {
236
237
if ( columns [ column ] . style ) {
237
238
td . style = columns [ column ] . style ;
238
239
}
240
+ } else if ( columns [ column ] . type !== 'text' ) {
241
+ selectTd ( td , columns [ column ] . type , '' , column ) ;
242
+ if ( columns [ column ] . style ) {
243
+ td . style = columns [ column ] . style ;
244
+ }
239
245
}
240
246
tr . setAttribute ( 'data-key' , key ) ;
241
247
tr . appendChild ( td ) ;
0 commit comments