Skip to content

Commit

Permalink
For #327 - add invisible form to the root panel before report calcula…
Browse files Browse the repository at this point in the history
…tion, remove it after submitting form
  • Loading branch information
vitalidze committed Nov 16, 2015
1 parent fe22727 commit fb4df12
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.Hidden;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.data.shared.ListStore;
import org.traccar.web.client.i18n.Messages;
import org.traccar.web.client.model.BaseAsyncCallback;
Expand Down Expand Up @@ -105,13 +106,19 @@ public void onGenerate(Report report) {

private void generate(Report report) {
FormPanel form = new FormPanel("_blank");
form.setVisible(false);
form.setAction("traccar/report");
form.setMethod(FormPanel.METHOD_POST);
form.setEncoding(FormPanel.ENCODING_URLENCODED);
HorizontalPanel container = new HorizontalPanel();
container.add(new Hidden("report", reportMapper.write(report)));
container.add(new Hidden("locale", LocaleInfo.getCurrentLocale().getLocaleName()));
form.add(container);
form.submit();
RootPanel.get().add(form);
try {
form.submit();
} finally {
RootPanel.get().remove(form);
}
}
}

0 comments on commit fb4df12

Please sign in to comment.