DOJO 1.8移动小部件无法在屏幕上呈现

时间:2012-10-29 23:42:46

标签: javascript listview mobile dojo

我对DOJO小部件“dojox / mobile / _DataListMixin”有疑问。 基本上,我在我的html中定义了小部件,如:

<ul data-dojo-type="dojox.mobile._DataListMixin" id="meetingul"> </ul>

我的目标是将列表项小部件放在<ul>中。我必须这样做的javascript就是这个。 `

require(["dojox/mobile/parser",
     "dijit/registry",
     "dojo/request",
     "dojox/mobile/_DataListMixin",
     "dojox/mobile/_DataMixin",
     "dojo/_base/array",
     "dojo/store/Memory",
     "dojox/mobile",
     "dojox/mobile/ScrollableView",
     "dojox/mobile/DatePicker",
     "dojox/mobile/Button",
     "dojox/mobile/TabBar",
     "dojox/mobile/compat"
     ],
function(parser, registry, request,DataListMixin,DataMixin,basearray,store) {
    // Parse the page for widgets!
    parser.parse();

    gotoToday = function(){
    registry.byId("dpw").reset();
        }
showSelectedValue = function(){
        var w = registry.byId("dpw");
        //console.log(w);
        var d = w.get("value");
 // var d =  w.slots[0].get("value")+ "-" + w.slots[1].get("value") + "-" + w.slots[2].get("value"); //gets same value as above line but "OCT" instead of 11
      return d;
    }
    fillMeetings = function(){
        var date = registry.byId("dpw");
        var meetingdes = document.getElementById("meetingdescription");
        var meetingul = document.getElementById("meetingul");
        //registry.byId("meetings").innerHTML  =  showSelectedValue();
        var sqldate = {sqldate:showSelectedValue()};

        var deferred = request.post("resources/meetingsarray.php",
            {data:sqldate,
            handleAs: "json"});


        deferred.then(function(res){
            console.log(res);
               var meetingul = registry.byId("meetingul");
               var meetingsview = registry.byId("meetings");
               var memstore = new store({data:res});
               var memdata = memstore.data;
               console.log(memstore);
                 // datamixin.setStore(memstore);

                onComplete:{
                        meetingul =  DataListMixin(DataMixin(memstore), request);
                            }

        },
          function(error){
                    console.log("An error occurred: " + error);
                });
    }
    });

       </script> `

memstore变量正在以JSON格式获取我想要的正确数据,但它不像我想要的那样填充ul。没有错误,我只是觉得我遗漏了一些基本的东西。如果您有任何建议请回复,谢谢。

1 个答案:

答案 0 :(得分:0)

我看不出这条线是如何工作的

  meetingul =  DataListMixin(DataMixin(memstore), request);

您很容易为变量赋值,这样做不会影响列表中的内容。

我有这样的代码:

  var meetingul = registry.byId("meetingul");

  var store = new Memory({ 
    data : mydata
  });

  meetingul.setStore(store);