Мобильные виджеты jQuery не отображаются в среде require.js/backbone

Создание мобильного приложения с использованием phonegap/requirejs/backbone.

Вот файл просмотра:

define(['jquery','backbone',"text!templates/summary.tpl",'handlebars','jquery.mobile'],function($,Backbone,Template,Handlebars){

//now create a backbone view
var SummaryView = Backbone.View.extend({
el: $('#mcontent'), // attaches `this.el` to an existing element. 

events:{
    'pageinit':'',
},

 //initialize template 
template:Handlebars.compile(Template),

initialize: function(){     
    _.bindAll(this, 'render'); // fixes loss of context for 'this' within methods                  
    this.render();
},

render: function(){
    this.fill_body();
    this.footer();
    $('body').show();       
},

fill_body: function(){
    this.$el.append(this.template());
    return this;
},


footer: function(){ 
    this.$el.append('<div data-role="footer"><h4>Footer content</h4></div>');
    return this;
}


});

и основной файл requirejs:

require.config({
    paths:{
    jquery:'vendor/jquery/jquery.min',
    'jquery.mobile':'vendor/jquery.mobile-1.3.1.min',
    'jquery.mobile-config':'jqm-config',
    underscore:'vendor/underscore/underscore-min',
    backbone:'vendor/backbone/backbone-min',
    handlebars:'vendor/handlebars/handlebars',
    text:'vendor/text/text',
    },

    shim: {
        'backbone': {
            //These script dependencies should be loaded before loading backbone.js
            deps: ['jquery','underscore'],
            //Once loaded, use the global 'Backbone' as the module value.
            exports: 'Backbone'
        },

        'underscore': {
            exports: '_'
        },

    'handlebars' : {
            exports : "Handlebars"
        },

    'jquery.mobile-config': {
            deps: ['jquery']
    },  

    'jquery-mobile': {
        deps:['jquery','jquery.mobile-config'],
    },

    },

    waitSeconds: 5
});


require(['views/test'],function(TestView){         
    new TestView;

и когда представление отображается, я вижу оба файла jquery mobile js/css, присутствующие на странице. Но когда я визуализирую этот HTML, он просто появляется без рендеринга элементов jquery mobile css.

Для ссылки: страница html:

 <div id="summary_page">
  <div data-role="page">
    <div data-role="content" class="summary" >
      <ul data-role="listview" >
    <li class="ui-btn-right" id="brands"> Brands </li>
    <li class="ui-btn-right" id="pprofile">Personal Profile</li>
    <li class="ui-btn-right" id="snetworks">Social networks</li>
    <li class="ui-btn-right" id="tos">Terms and conditions</li>
    <li class="ui-btn-right" id="ppolicy">Privacy/cookies</li>
      </ul>
    </div>
  </div>    
</div>

Кто-нибудь знает, почему css jquery mobile не отображается на странице. В настоящее время я занимаюсь разработкой на платформе Android для phonegap.


person user1102171    schedule 12.06.2013    source источник


Ответы (1)


попробуйте вызвать триггер («создать») на соответствующей странице, чтобы обновить его.

person nsawaya    schedule 12.06.2013
comment
Ну, пока я не использую jquery mobile. Обработка других проблем с рендерингом полной ширины в Android .... и выполнение всего этого с использованием обычного css ... Я однажды попробовал то, что вы сказали, но это не работает .... вернусь к этому позже .. все равно спасибо . - person user1102171; 13.06.2013