Problem with Ajax evaluator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with Ajax evaluator

Sebastia Van Lacke
 
Hi, I am having a problem with ajax. I'm using an evaluator to update some parts of my page, everything going well, except for a few graphics made with the Google charts API. All the callbacks are executed, and executes the rendering code correctly , but the change is not displayed until I make a complete refresh. Any idea what could be happening?
 
QuestionnaireComponent >> renderGraphicsOn: html
 
 html div id: 'graphics'; with: [
    html heading level: 4; with: 'Score for team'.
   html div id: 'teamsGraphic'; with: [
    self renderTeamsScoreGraphicOn: html.
   ].  
   html heading level: 4; with: 'Score for metric'.
   html div id: 'metricsGraphic'; with:[
    self renderMetricsScoreGraphicOn: html
   ]
  ]
 
QuestionnarieComponent >> renderPossibleAnswersForQuestion: question withIndex: index on: html
 
html form:[
  (html select)
   id: index asString;
   list: question answers;
   labels: [:each | each text];
   selected: (questionnaire choiceForQuestion: question) answer;
   callback: [:value | selection := value];
   onChange:
    ((html evaluator)
     triggerFormElement: index asString;
     callback: [:script | 
      questionnaire answer: question with: selection by: self session user username.
      (script element)
       id: 'personDiv' , index asString;
       update: [:r | r text: 'answered by ' , (questionnaire choiceForQuestion: question) person].
      (script element)
       id: 'scoreDiv';
       update: [:r | self renderScorePanelOn: r].
      (script element)
       id: 'submitButton';
       update: [:r |  self renderEvaluateButtonOn: r ]. 
      (script element) 
       id: 'teamsGraphic';
       update: [:r | self renderTeamsScoreGraphicOn: r].
      (script element)
       id: 'metricsGraphic';
       update: [:r | self renderMetricsScoreGraphicOn: r].
      (script element)
       id: 'submitButton';
       update: [:r |  self renderEvaluateButtonOn: r ]])]
 
---------------------------------------------------------------------------------------------------------------------------
 
QuestionnaireComponent >> renderTeamsScoreGraphicOn: html
 
 html render: teamsComponent
 
-------------------------------------------------------------------------------------------------------------------------
 
 
Sebastián Van Lacke

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Ajax evaluator

Lukas Renggli
> Hi, I am having a problem with ajax. I'm using an evaluator to update some
> parts of my page, everything going well, except for a few graphics made with
> the Google charts API. All the callbacks are executed, and executes the
> rendering code correctly , but the change is not displayed until I make a
> complete refresh. Any idea what could be happening?

It sounds like the Google Charts API is not evaluated.

What version of Seaside are you using? What platform? What did FireBug say?

Lukas


>
> QuestionnaireComponent >> renderGraphicsOn: html
>
>  html div id: 'graphics'; with: [
>     html heading level: 4; with: 'Score for team'.
>    html div id: 'teamsGraphic'; with: [
>     self renderTeamsScoreGraphicOn: html.
>    ].
>    html heading level: 4; with: 'Score for metric'.
>    html div id: 'metricsGraphic'; with:[
>     self renderMetricsScoreGraphicOn: html
>    ]
>   ]
>
> QuestionnarieComponent >> renderPossibleAnswersForQuestion: question
> withIndex: index on: html
>
> html form:[
>   (html select)
>    id: index asString;
>    list: question answers;
>    labels: [:each | each text];
>    selected: (questionnaire choiceForQuestion: question) answer;
>    callback: [:value | selection := value];
>    onChange:
>     ((html evaluator)
>      triggerFormElement: index asString;
>      callback: [:script |
>       questionnaire answer: question with: selection by: self session user
> username.
>       (script element)
>        id: 'personDiv' , index asString;
>        update: [:r | r text: 'answered by ' , (questionnaire
> choiceForQuestion: question) person].
>       (script element)
>        id: 'scoreDiv';
>        update: [:r | self renderScorePanelOn: r].
>       (script element)
>        id: 'submitButton';
>        update: [:r |  self renderEvaluateButtonOn: r ].
>       (script element)
>        id: 'teamsGraphic';
>        update: [:r | self renderTeamsScoreGraphicOn: r].
>       (script element)
>        id: 'metricsGraphic';
>        update: [:r | self renderMetricsScoreGraphicOn: r].
>       (script element)
>        id: 'submitButton';
>        update: [:r |  self renderEvaluateButtonOn: r ]])]
>
> ---------------------------------------------------------------------------------------------------------------------------
>
> QuestionnaireComponent >> renderTeamsScoreGraphicOn: html
>
>  html render: teamsComponent
>
> -------------------------------------------------------------------------------------------------------------------------
>
>
> Sebastián Van Lacke
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Ajax evaluator

Sebastia Van Lacke
In reply to this post by Sebastia Van Lacke
Thanks Lucas, I just found the error... was me. jeje

The first element that I was trying to update, did not exist in that moment, then the others updates where not being executed, and Firebug does not report any bug. I don't know if should do it.
 
Regards
 
Sebastián
 
 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Problem with Ajax evaluator

Lukas Renggli
> Thanks Lucas, I just found the error... was me. jeje
> The first element that I was trying to update, did not exist in that moment,
> then the others updates where not being executed, and Firebug does not
> report any bug. I don't know if should do it.

Did you enable that FireBug should report all JavaScript errors and warnings?

Sometimes this is not enabled.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside