0

Question with data stored

Hello.

I have a widget which have some Views. In the View A, I have some data arrays that it's are loaded in next view (View cool.gif

CODE
KONtx.application.loadView("view-Detalle",{
img_rest : imagenesRestaurantes[this.getCellDataIndex()],
price_rest : preciosRestaurantes [this.getCellDataIndex()],
address_rest : direccionesRestaurantes[this.getCellDataIndex()],
hours_rest : horariosRestaurantes[this.getCellDataIndex()],
phone_rest : telefonosRestaurantes [this.getCellDataIndex()],
tipo_rest : tipo_cocina[this.getCellDataIndex()],
desc_rest : descripcionRestaurantes[this.getCellDataIndex()],
name_rest : nombresRestaurantes[this.getCellDataIndex()]});


I can to access for example at img_rest in "view-Detalle" using ' this.persist.img_rest ' . In this step no problem.

My problem is the opposite case. I have a View C, which updates datas from View B.

In View B
CODE
 KONtx.application.loadView("view-CambioRest", {
numRest : numeroRest,
});


In View C
CODE
  currentProfileData.set('numRest',numeroRestaurante);
self.persist.numRest = numeroRestaurante;


And I don't know how load ' self.persist.numRest ' in View B and show it in my widget.

Thanks all you

8 Replies
  • I forgot to say that in first place, i can't to use currentProfileData.get(...) because i have several telephone numbers and if I use currentProfileData.get(..), this data is the same for all telephones, and I want to put only one number.
    0
  • Well, I have solved my problem.

    But, I have other problem now. I can load phone numbers in next View. If I go back to previous View and go back inside, the new phone number seems not saved, but the second time and subsequent, the new phone number it's saved and loaded correctly; ie I have to perform the procedure twice to display.

    Some idea? Thanks a lot of
    0
  • Need to see some code. It is hard to say where the issue might be.
    0
  • QUOTE (WidgetRealm @ Jul 7 2010, 09:02 AM) <{POST_SNAPBACK}>
    Need to see some code. It is hard to say where the issue might be.



    In my "View B"

    CODE
    updateView: function (){

    posicionTel = this.persist.posicion_tel; // position of restaurant's phone number in array of numbers.
    arrayTel = this.persist.todos_tel; // all completed array of phone numbers
    nuevoTel = KONtx.messages.fetch('nuevoNum'); // This is the new number writed in "View C".

    if(KONtx.messages.fetch('nuevoNum') != null)
    {
    arrayTel[posicionTel]=nuevoTel;
    this.persist.phone_rest=arrayTel[posicionTel];
    this.controls.telefono.setText(this.persist.phone_rest);

    }else{

    this.controls.telefono.setText(this.persist.phone_rest);

    }
    numContacto = arrayTel[posicionTel];
    KONtx.messages.remove('nuevoNum');

    } // end updateView


    My problem it's simple. It seems that only is saved and shown my new number since second time that I change the number. The first time, I change the number in the View C, back to View B, this new number is shown perfect, but If I back to View A and return to View B, it's shown the old number. Repeat, this only in first time. Next times the new number its shown perfectly.
    0
  • Are you using KONtx.application.previousView() to go back to the other view or are you calling it directly?
    0
  • Yes, I'm using KONtx.application.previousView(); could this method be the problem??
    I don't know another form to back previous view storing datas.
    0
  • I need to check, but I believe the updateView() function is not called when using application.previousView()...

    You might try not using previousView() and calling to updateView() eachtime by not storing the view in the View Stack. Take a look a the last value available in the loadview() command. You can set this to "true" to have it skip saving the view in the stack.
    0
  • You will also be able to pass in the new information while calling the view.
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets