Closed GoogleCodeExporter closed 9 years ago
Does your statement() function return something like:
return new JsQuery(this).$().chain("highchart");
This ensures that the jquery code is fired upon domready and not instantly.
Original comment by hielke.hoeve
on 23 Jun 2011 at 2:16
This will render the following javascript:
$(document).ready(function() {
$('#idc').dropDownChoice();
}
Note that this javascript and the above java code are only examples.
Original comment by hielke.hoeve
on 23 Jun 2011 at 2:18
Here's what it was before I changed to my method:
final JsStatement statement = new JsQuery().document().ready(
new JsScope() {
@Override
protected void execute(final JsScopeContext scopeContext) {
final ObjectMapper mapper = new ObjectMapper();
// Setup the options for this graph instance
setupOptions();
try {
// Map the options to JSON
final String optionsJson = mapper
.writeValueAsString(options);
// Add the javascript to the component
scopeContext.append("new Highcharts.Chart("
+ optionsJson + ");");
} catch (final JsonGenerationException e) {
throw new UnhandledException(e);
} catch (final JsonMappingException e) {
throw new UnhandledException(e);
} catch (final IOException e) {
throw new UnhandledException(e);
}
}
});
LoggerFactory.getLogger(this.getClass()).debug(
statement.getStatement().toString());
return statement;
Original comment by fishca...@gmail.com
on 23 Jun 2011 at 2:19
Check this class, it also uses wiquery to build highcharts:
https://github.com/hielkehoeve/wiquery-highcharts/blob/master/src/main/java/nl/t
opicus/whighcharts/components/WHighChart.java
wiquery already adds the document ready statement and appends all statement()
output into this. having double nested document ready statements could break
things.
Original comment by hielke.hoeve
on 27 Jun 2011 at 8:07
Original comment by hielke.hoeve
on 17 Aug 2011 at 8:06
Original issue reported on code.google.com by
fishca...@gmail.com
on 23 Jun 2011 at 1:44