1

我对 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像我想要的那样填充。没有错误,我只是觉得我缺少一些基本的东西。如果您有任何建议,请回复,谢谢。

4

1 回答 1

0

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

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

您只是简单地为变量赋值,这样做不会影响列表中的内容。

我有这种代码:

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

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

  meetingul.setStore(store);    
于 2012-10-30T07:43:55.243 回答