xTuple.com xTupleU Blog & News Customer Support

Indent Columns on custom UI Forms

I created a topic similar to this, but I do now that this is a bug.
I am attempting to use xtindentrole to add the dropdowns. inside of an XTreeWidget.

This shows my table


And This shows my Metasql Results

I clearly have xtindentrole And it has the correct values in the metasql. but Inside of my custom screen, no indentation occurs.

The rows also need to be sorted so that xtindentrole is in the proper order, meaning the 1 values need to come after the 0 parent rows.

slithead_id  |  altid  |  slithead_number  |  xtindentrole
7            |  -1     |  1006             |  0
7            |  14     |                   |  1
9            |  -1     |  1007             |  0
9            |  18     |                   |  1

For example. This should indent the second row under first, and the fourth row under the third.

I have multiple child rows for one parent row. It is confusing since there are multiple parents with no children. but if you refer to the slithead_id you can see the parent child relationship. “19” is the only parent with children. and it has 4 children

Caleb,

The data on your custom form look like they match the MetaSQL query results. As you pointed out the xtindentrole looks correct and the order looks right, to David’s point.

The piece that seems to be missing is the indentation markers:arrow_forward:︎ and ▼. Is that right?
We’ve seen this a couple of times. The most common cause is hiding the left-most column in the XTreeWidget. Try right-clicking on the table header and make sure the very first column has a checkmark to show it’s visible

If that doesn’t explain it, it’s still possible that the indentation is being handled correctly except for the on-screen rendering. You can see if this is the case by adding “expand all” and “collapse all” buttons, or by double-clicking on the left-most column to see if the expansion/collapse can be triggered anyway.

Gil

None of these seem to be my problem
image

I also checked _xtreewidget.topLevelItemCount just to verify that nothing was rendering incorrectly.
I tried to force the _xtreewidget.collapseAll() with no results.

In the script I am using _xtreewidget.populate(toolbox.executeDbQuery('foo','bar',params))

And I noticed the XTreeWidget flag for PopulateLinear is set to true.

It seems to be a code side not a visual side.

Strange.

Here’s a minimal extension to build a Display window and populate it with an indented list. It should show at least one row when collapsed and two rows when expanded. Some databases will have many more than two rows. To use it:

  • System > Test Indentation
  • click QUERY

Try comparing what you’ve done with this minimal test case. It works with 5 different versions of the xTuple desktop client (tried 4 on Mac, 1 on Windows), so the problem is most likely not a core product bug.

Gil
indentTest-0.0.1.gz (1.4 KB)

I have some testing to do.
This test did come back with the correct functionality. In an attempt to make a minified version of my problem I couldn’t reproduce it. My data is not not fake so it looks better but the screen I’m working on still doesn’t work. Ill get back when I know more

One thing you could do to eliminate a variable is to take Gil’s sample display and change it to use your metasql query. You will need to update the column statements being added to the list to match yours as well but it would let you know if your query was correct at least.

Okay. So on a new blank UI. I got Gil’s SQL to work. I switched it out with mine without changing anything and I got this.

Which is exactly what I’m expecting.

Now Im adding the columns in the same UI

No indentation…

I guess that reduces the problem down to my script at this spot

_result.addColumn(qsTr("Slit Plan#"),-1,1,"slithead_number");
_result.addColumn(qsTr("Type"),-1,1,"ltype");
_result.addColumn(qsTr("Weight"),-1,1,"weight");
_result.addColumn(qsTr("Cuts"),-1,1,"cuts");
_result.addColumn(qsTr("Date"),-1,1,"plandate");

So I changed those lines to closer match Gil’s example.

_result.addColumn(qsTr("Slit Plan#"),-1,Qt.AlignLeft,true,"slithead_number");
_result.addColumn(qsTr("Type"),-1,Qt.AlignLeft,true,"ltype");
_result.addColumn(qsTr("Weight"),-1,Qt.AlignRight,true,"weight");
_result.addColumn(qsTr("Cuts"),-1,Qt.AlignRight,true,"cuts");
_result.addColumn(qsTr("Date"),-1,Qt.AlignRight,true,"plandate");

An that seems to be the problem.
image .

I narrowed it down to using the true parameter. when I add columns to the XTreeWidget.

Thanks for all the help on this. I have been struggling for over a year to understand why this was happing.