1

I have got one issue here. I am using bootstrap css and gwt in my application. In my uibinder page, I am using gwt textbox, and applying a style ("date") as shown below.

<g:TextBox styleName="span11 date"></g:TextBox>

Also bootstrap-datepicker.js and related bootstrap css files have been attached. On loading of a html, I am running the below script.

$( document ).ready(function() {
    $('.date').datepicker({
        format: 'm/d/yyyy',
        showWeek: true,
        startDate: 'today',
        autoclose: true,
      });
});

Still bootstrap datepicker popup is not coming on focus of a gwt textbox.

Also, I tried the otherway round, by injecting the js file and using JSNI approach.

Still it didn't worked..

Also, when I open the browser console (using F12), and paste the above javascript snippet, it works fine.

Is there anything settings/configurations needs to be done?

Is GWT is blocking the javascript execution???

Any suggestions would be appreciated!!!

Thanks

yogish
  • 85
  • 17

2 Answers2

1

If you want to use Bootstrap in your GWT application, I'd strongly suggest using the existing libraries like gwtbootstrap3 or gwt-bootstrap.

The problem here is probably due to the fact that the TextBox has not been added to the DOM yet. All the scripts might have been loaded, but that doesn't mean the whole view has been build by GWT (try adding a delay in that function to see if I'm right). You could add a "callback" method in your view (called when the view is available) that will invoke a method in your host page that will convert the TextBox to a datepicker... But unless that's the only widget in your application that you are using from Bootstrap, I'd suggest using a proper library that imports Bootstrap's widgets in a more GWT way.

Igor Klimer
  • 15,321
  • 3
  • 47
  • 57
0

Make sure that you include your

<script src=".nocache.js"></script>

before

<script src="bootstrap.min.js"></script>
Vadim
  • 1,125
  • 8
  • 18