← Back to team overview

ubuntu-phone team mailing list archive

Re: U1db as repeater model, QQmlExpression error

 

Hello Christian,
Here's the removeDeck() function from DB.js:
function removeDeck(deckLanguage, deckColor) {    var tempContents = {};    tempContents = deckDB.contents;    for (var i = 0; i < tempContents.decks.length; i++) {        if (tempContents.decks[i].deckLanguage == deckLanguage && tempContents.decks[i].deckColor == deckColor){            tempContents.decks.splice(i, 1);            break;        }    }    deckDB.contents = tempContents;}
and in the Dialog, I just call PopupUtils.close(); mainStack.pop() and DB.removeDeck(). I think the problem might be in the Repeater, although I am not sure.
> Date: Mon, 2 Feb 2015 21:43:36 +0100
> From: christian.dywan@xxxxxxxxxxxxx
> To: bogdan.cuza@xxxxxxxxxxx; ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Ubuntu-phone] U1db as repeater model, QQmlExpression error
> 
> On 02.02.2015 21:33, Bogdan Cuza wrote:
> > Hello, everyone!
> >
> > I have asked for help on Google+, but this might be a better place for
> > that.
> > Here I have the following situation:
> >  1) Repeater with U1db contents as model
> >  2) An edit page, which the user goes to (it has a delete dialog)
> >  3) User deletes an item (I create tempContents, splice from the array
> > and set the U1db contents = tempContents)
> >  4) Pop the edit page
> > And I get this: QQmlExpression: Attempted to evaluate an expression in
> > an invalid context
> > I know something like this has been seen in the settings app, but here
> > the situation is a little different as I am not using a ListView.
> > Moreover, I tried to change the execution order to clear the
> > pagestack, then remove the item, then push the page again (the page
> > should be reloaded, because I push a file ie Qt.resolvedUrl), but I
> > get the same error. Can anyone help me?
> >
> Hey Bogdan,
> 
> could you provide some code so there's a way to see exactly what you're
> doing? If it's in a complex app maybe copy the relevant bits into a
> template app so it's easy to see what's going on.
> 
> ciao,
>     Christian
> 
 		 	   		  

Follow ups

References