English 中文(简体)
Quoxdoo - 是否有办法找到虚拟树叶选择的母体?
原标题:Qooxdoo - Is there a way to get at the parent of a VirtualTree selection?
  • 时间:2012-05-23 14:30:08
  •  标签:
  • qooxdoo

我与“虚拟树枝演示”一起, 似乎无法找到办法,

tree.getSelection().addListener("change", function(e){
    var selection = tree.getSelection();
    console.log(selection.getItem(0).getName()); // works just fine to get the name
}

我想到JSON商店的"祖父母"和"父母"的地产

  {
      "name": "root",
      "children": [
        {
          "name": "Grandparent",
          "children": [
            {
              "name": "Parent",
              "children": [
                {
                   "name": "Name of my Selected Item",

我试过了

tree.getModel().getChildren().getItem(0)

但获取 X 值以获得项目(X) 也不是直截了当的。

我很感激你能帮上忙 谢谢!

最佳回答

由于树类数据模型默认情况下没有任何父目录引用。 实现这一点没有容易的方法。 但是, 您有两种选择 。

  1. 您可以使用自己的树类作为模型, 并自行执行父参考。 这可以通过使用马歇尔的代表来完成 [1] 。 只需确保您不为父参考启动泡沫事件, 因为这样会导致一个死锁 。

  2. 您可以使用搜索算法获取父值。 如果您不需要经常使用该引用, 且您的数据并不大, 这也是您可以使用的方法 。

[1] [a href="http://demo.qooxdoo.org/sign/apiviewer/#qx.data.marshal.IMarshalerDelegate" rel="nofollow">http://demo.qooxdoo.org/sign/apiviewer/#qx.data.marshal.IMarshalerDelegate

问题回答

暂无回答




相关问题
qx.ui.table.Table hangs my browser

I have a strange bug. I create a qx.ui.table.Table and if not all specified columns fit into window (horizontal scroll appear) my browsers (firefox 3.5.6 and chrome 5.0.344) hangs. If i just set width ...

qx.io.remote.Request: post parameters in body and url

when creating and sending an http POST request like this... var req = new qx.io.remote.Request("/test","POST"); req.setParameter("pi", "3.1415"); req.setParameter("color", "...

Trouble Getting Data from a Webservice using Qooxdoo

My capstone team has decided to use Qooxdoo as the front end for our project. We re developing apps for OpenFlow controllers using NOX, so we re using the NOX webservices framework. I m having trouble ...

How best to share a QooXDoo using Git?

I m developing a little project with QooXDoo and want to share the source with some friends. Should I just check in the whole project folder?

Table decoration in Qooxdoo

Is it possible to set the background color of one Row in a Table? I need to highlight a row when a condition applies. Something to the effect of < tr font="...">...< /tr> where I can ...

parameter passing to a standalone qooxdoo application

How can I pass parameters to a stand alone qooxdoo applicatoin? Thanks in advance :) update: I was thinking of passing URL parameters; something like GET/POST params when an html FORM is submitted. ...

testing source application in qooxdoo

I began to use Qooxdoo the last month so i ve got very little experience in its usage. I need to create a test application like the testrunner on the Qooxdoo website, but i need to do tests inside my ...

热门标签