0

I need to refill my grid each time the user sets a new date (data from a WebService). According to event triggering order, I was thinking of:

(1) Action Event: call a procedure to get the data, transform it, fill the SDT and put it on a WebSession var.

(2) Refresh Event: re-build the local SDT with the new values.

(3) Load Event: Load the grid.

However, when I build this, I can see a warning saying:

spc0185: Websession's contents will not be preserved between calls to Refresh event.

And I can confirm that the behaviour is a bit odd (the grid is only refreshed the fist time user changes the date).

Event &myDate.ControlValueChanged
    composite
        setGridJson(&mydate)
        Refresh
    endcomposite
Endevent

Event Refresh
    &mydate = ctod(&websession.get('newDate')) //to refresh the date var
    &myJSON = &websession.get('GridJSON')
    &mySDT.FromJson(&myJSON)
Endevent

Event Load
    for &mySDTItem in &mySDT
        &field1 = &mySDTItem.field1
        &field2 = &mySDTItem.field2 
        &field3 = &mySDTItem.field3 
        LOAD
    endfor
Endevent

Is there any workaround for this? How can I refill the grid each time the &myDate var changes?

Thanks

Jaime
  • 159
  • 2
  • 10
  • I think there is a better way to solve what you want, that does not involve the use of a websession. If the grid is based on the SDT instead of variables, you could assign the SDT in the 'ContolValueChanged' event and it will be reloaded automatically. – Marcos Crispino Nov 04 '14 at 16:04
  • I have been following this guide, to implement "Order" and "Break By" in my grid, despite not having database attributes (it seems that it is only possible though separate variables on the grid, that's why I am trying to do things this way): http://wiki.genexus.com/commwiki/servlet/hwiki?HowTo%3A+External+Services+%28Scenario1%29, – Jaime Nov 04 '14 at 16:58
  • Just found out that the problem is not related to the refresh event (despite the warning). The &myDate control value can be changed manually (in the control) and programatically (buttons "Previous Day" and "Next Day"). This works well but, once the user changes the date in the control, the programatic date assignation (buttons) stops working (hence the grid is not being updated). Is there any solution for this? (btw, sorry for the mess on this topic) – Jaime Nov 04 '14 at 18:34
  • @Jaime The status of this question is a bit unclear but JFYI, the bug with the date control is fixed and will be released with ev3u3. – matiash Dec 04 '14 at 14:48
  • @matiash, I iniatially thought the issue was related to the warning "Websession's contents will not be preserved...". Only when i tested this thoroughly I detected and reported the problem. OK, I'll wait fot he fix then. Thank you for your feedback. – Jaime Dec 05 '14 at 15:25
  • @matiash is there anything i can do in my Gx installation to solve the problem for now? – Jaime Dec 11 '14 at 15:40
  • @Jaime If you contact support, they might be able to supply a patch for this issue. – matiash Dec 11 '14 at 16:13

0 Answers0