【问题标题】:Problem with setting the xml dataprovider for combo box为组合框设置 xml 数据提供程序的问题
【发布时间】:2009-11-02 11:45:13
【问题描述】:

我正在尝试使用 php 文件获取组合框的下拉列表。该 php 文件返回一个 xml 字符串,该字符串已用作组合框的数据提供者。

我也关注了this thread,但没有成功。

详情
我已将 mx:Application 的 creationComplete 属性设置为 init()。在 init() 函数中,我发送了以下 HTTPService

<mx:HTTPService id="interfaces" url="interfaces.php" resultFormat="e4x" method="POST"> 
 </mx:HTTPService>

组合框:

更新: xml 应该看起来像

<?xml version=\"1.0\" encoding=\"utf-8\"?>
  <ifaces>
    <iface>
      <option>eth0</option>
    </iface>
    <iface>
      <option>eth1</option>
    </iface>
  </ifaces>

但是如果我在浏览器中执行interfaces.php,唯一能显示的就是 eth0eth1 而我正在回显包含整个 xml 数据的字符串。不应该显示整个 xml 类型的字符串吗? :(

【问题讨论】:

    标签: apache-flex combobox dataprovider


    【解决方案1】:

    问题在于 ifaces 是 XML 的根元素,因此 interfaces.lastResult == ifaces。所以你想要的 XMLList 是interfaces.lastResult.iface。

    这是对我有用的整个主要课程:

    `

    应用程序>`

    【讨论】:

    • 它没有用。我实际上按照以下线程解决了我的问题,但还没有成功。
      stackoverflow.com/questions/1476697/…
    • 如果问题是你看不到你的 php 正在输出什么,当你在 php 页面上点击“查看源代码”时你会看到什么?
    • Susichan,查看源代码显示我的 xml 有问题。我已经纠正了错误,现在生活很好; :) 非常感谢。 :D
    猜你喜欢
    • 1970-01-01
    • 2019-05-10
    • 2018-10-11
    • 1970-01-01
    • 2013-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-29
    相关资源
    最近更新 更多