Skip to content

Commit 2053199

Browse files
author
Henrik jJaven
committed
WIP attribute change
1 parent 26489b8 commit 2053199

File tree

1 file changed

+40
-13
lines changed

1 file changed

+40
-13
lines changed

frameworks/keyed/doohtml/js/Main.class.js

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Doo.define(
113113
this.data.rows = this.buildData()
114114
stop('buildData')
115115
start('run')
116-
this.tbody.textContent = ""
116+
this.tbody.textContent = ''
117117
this.renderTable()
118118
e.target.blur()
119119

@@ -160,14 +160,11 @@ Doo.define(
160160
// }
161161

162162

163-
// async attributeChangedCallback(name, oldVal, newVal) {
164-
// if (name === 'key' && newVal.length > 0) {
165-
// this.tbody.childNodes[newVal].childNodes[1].childNodes[0].innerHTML = this.data.rows[newVal].label
166-
// // if (newVal == 9999) {
167-
// // stop('runLots')
168-
// // }
169-
// }
170-
// }
163+
async attributeChangedCallback(name, oldVal, newVal) {
164+
if (name === 'key') {
165+
this.tbody.replaceChild(this.tr[newVal], this.tbody.childNodes[newVal])
166+
}
167+
}
171168

172169

173170

@@ -180,13 +177,43 @@ Doo.define(
180177
elem.id = 'tbody'
181178
let len = dataSet.length
182179
elem.innerHTML = this.renderNode(this.place[0], this.data.rows, 0 , len)
183-
let tr = elem.querySelectorAll('tr')
180+
this.tr = elem.querySelectorAll('tr')
184181

185-
for (let i=0;i<len;i++) {
182+
// for (let i=0;i<len;i++) {
183+
// //let newRow = tableRef.insertRow(-1)
184+
// //newRow.innerHTML = appendChild()
185+
// this.setAttribute('key', i)
186+
187+
// // this.tbody.append(tr[i])
188+
// }
189+
for (let i=0;i<100;i++) {
190+
//let newRow = tableRef.insertRow(-1)
191+
//newRow.innerHTML = appendChild()
192+
//this.setAttribute('key', i)
193+
194+
this.tbody.append(this.tr[i])
195+
}
196+
for (let i=100;i<len;i++) {
186197
let newRow = tableRef.insertRow(-1)
187-
newRow.parentElement.replaceChild(tr[i], newRow)
198+
newRow.innerHTML = this.tr[i].childNodes[0].outerHTML
199+
// this.tbody.append(this.tr[i])
188200
}
189-
// this.tbody = this.shadow.querySelector('#tbody')
201+
202+
203+
// this.tbody.childNodes[len-1].scrollIntoView()
204+
setTimeout(() => {
205+
for (let i=100;i<len;i++) {
206+
//let newRow = tableRef.insertRow(-1)
207+
//newRow.innerHTML = appendChild()
208+
this.setAttribute('key', i)
209+
210+
// this.tbody.append(tr[i])
211+
}
212+
}, 1)
213+
214+
215+
216+
// this.tbody = this.shadow.querySelector('#tbody')
190217
// elem.textContent = ''
191218
// this.lastRun = elem
192219
// this.tbody.childNodes[len-1].scrollIntoView()

0 commit comments

Comments
 (0)