- fix: check if need refresh.. part 1

- keytab in todo...
This commit is contained in:
Paolo Arena
2019-02-04 04:17:50 +01:00
parent b2e760faa9
commit fb099322d4
5 changed files with 55 additions and 13 deletions

View File

@@ -61,7 +61,7 @@ export default class SingleTodo extends Vue {
}
@Watch('itemtodo.descr',) valueChanged5() {
@Watch('itemtodo.descr') valueChanged5() {
this.precDescr = this.itemtodo.descr
}
@@ -234,6 +234,8 @@ export default class SingleTodo extends Vue {
exitEdit(singola: boolean = false) {
if (this.inEdit) {
if (this.precDescr !== this.itemtodo.descr)
this.updateTodo()
// console.log('exitEdit')
this.inEdit = false
this.updateClasses
@@ -243,11 +245,30 @@ export default class SingleTodo extends Vue {
keyDownArea(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
/*
if ((e.key === 'ArrowUp') && !e.shiftKey) {
e.key = 'Tab'
e.shiftKey = true
}
if ((e.key === 'ArrowDown') && !e.shiftKey) {
let nextInput = inputs.get(inputs.index(this) + 1)
if (nextInput) {
nextInput.focus()
}
}
*/
if (((e.key === 'Enter') || (e.key === 'Tab')) && !e.shiftKey) {
this.updateTodo()
this.deselectRiga()
this.faiFocus('insertTask', true)
if ((e.key === 'Tab') && !e.shiftKey) {
} else {
e.preventDefault()
this.deselectRiga()
this.faiFocus('insertTask', true)
}
}
// console.log('keyDownArea', e)
@@ -261,6 +282,9 @@ export default class SingleTodo extends Vue {
}
updateTodo() {
if (this.itemtodo.descr === this.precDescr)
return
this.itemtodo.descr = this.precDescr
console.log('updateTodo', this.precDescr, this.itemtodo.descr)
this.watchupdate()

View File

@@ -41,6 +41,7 @@ export default class Todo extends Vue {
itemDragStart: any = null
itemDragEnd: any = null
selrowid: number = 0
polling = null
fieldtochange: String [] = ['descr', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'id_next', 'pos', 'enableExpiring', 'progress']
@@ -307,6 +308,10 @@ export default class Todo extends Vue {
// console.log('Array PRIOR:', this.arrPrior)
}
beforedestroy() {
clearInterval(this.polling)
}
async load() {
this.todos_arr = [...Todos.state.todos]
@@ -323,6 +328,9 @@ export default class Todo extends Vue {
await this.updatetable()
this.checkUpdate_everytime()
/*
this.todos_arr.forEach((elem, index) => {
this.logelem('LOAD ' + index, elem)
@@ -331,6 +339,13 @@ export default class Todo extends Vue {
}
// Call to check if need to refresh
checkUpdate_everytime() {
this.polling = setInterval(() => {
this.checkUpdate()
}, 10000)
}
copy(o) {
let output, v, key
output = Array.isArray(o) ? [] : {}