6

I have a very large treeGrid (~2000 elements in one node). And it seems to be frozen when I click [+] to expand it. I want to change mouse cursor state to 'wait' once clicked, but then to 'default' once expanded. Assume I can put it in onRowClick or onOpen event but what is onComplete event where I can reset the cursor? Also is there a way/property to see if row is expanded or collapsed? I want to change its style then.

var layout = [
  {
    cells: [
      [
        { field: "userid", name: "User Id" },
        {
          field: "childItems",
          children: [
            { field: "unid", name: "unid" },
            { field: "username", name: "User Name" },
            { field: "budget", name: "Budget" }
          ],
          aggregate: "sum"
        }
      ]
    ]
  }
]

var jsonStore = new dojo.data.ItemFileWriteStore({ url: <...............>});

var grid = new dojox.grid.TreeGrid(
  {
    structure: layout,
    store: jsonStore,
    query: { type: 'userid' },
    queryOptions: { deep: true },
    rowSelector: true,
    openAtLevels: [false],
    autoWidth: true,
    autoHeight: true,
    onRowClick: function (evt) {
      var idx = evt.rowIndex,
        item = this.getItem(idx);

      // ??????
    }
  },
  dojo.byId("treeGrid")
);
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
John Glabb
  • 1,336
  • 5
  • 22
  • 52
  • With 2000 elements, having a click event on every row seems to be inefficient. Unless Dojo implemented this event handler with performance in mind (1 click event on parent) then it might explain why it froze when you clicked on it. Maybe try adding 1 click event on the whole grid and detects when the nearest element is the + sign and then change the cursor? – Arielle Nguyen Aug 18 '18 at 10:22
  • Are you using the latest version of Dojo and are you using any other libraries besides Dojo? One thing you can do is attach some console.log calls to the event handler, to see when they are firing, and could include the event object in the log to see what is in it. – tremor Aug 18 '18 at 19:09

0 Answers0