xTuple.com xTupleU Blog & News Customer Support

Editable grid or treeview

Is there a widget that would permit to edit data within a grid instead of the having to call another dialog box to edit it?

I played with the xTreeWidget by allowing single selection and enabling all triggers possible but it seems that the cells within it are not editable. Am i missing something?

Do I have the wrong widget?

Thanks

Are you attempting to do this via scripting? If so, then probably not. However if you look at Purchase Order Quick Entry you can see an example of within grid data entry, so it is definitely possible but requires a lot of model/view coding to make it work.

XTreeWidget will let you edit columns in a grid but it is a bit awkward to deal with.

sEditColumn = function(pItem, pColumn) {
  if (pColumn == 2 || pColumn == 4) { // only allow editing on specific columns, by index
    _xtreewidget.openPersistentEditor(pItem, pColumn);
    _xtreewidget.editItem(pItem, pColumn);
  }
}

sCloseEditor = function(current, previous) {
  _xtreewidget.closePersistentEditor(previous, 2);
  _xtreewidget.closePersistentEditor(previous, 4);
}

_xtreewidget["itemClicked(XTreeWidgetItem*, int)"].connect(sEditColumn);
_xtreewidget["currentItemChanged(XTreeWidgetItem*, XTreeWidgetItem*)"].connect(sCloseEditor);

Basically when the row is clicked on it makes the columns you specify editable and when you click away it stops the editing of the previous row. Because this is via script you basically only get access to a textbox, can’t change the widget to a combobox or anything like that.

This might be awkward but it works very well!

Thanks a lot!

A lot of time ago I developed a package that with code adding widgets dynamically to ca container I simulated an editable grid. It worked really god and totally under control. I don’t remember even were is that core but it is possible.

Regards