We have found that if you add a group to an editable table the dynamic hide based on data-bindings no longer works.
It removes the headings but the column in the table remains.
We're using WM 3.1.2.
It removes the headings but the column in the table remains.
We're using WM 3.1.2.
RE: Dynamically Hiding Groups in Tables
RE: Dynamically Hiding Groups in Tables
I think you should be able to dynamically hide a column in a table using the bindings approach, and having just done a simple test it seemed to work ok.
So can you provide some more details about your page setup to help us track down why you are having problems?
For example:
What type of XPath are you using for the hide condition?
What other settings do you have enabled for the conditional group?
Is there a reason why you are using a group in the editable table, rather than just hiding the relevant field?
If you can provide a project export that would also be useful.
Hopefully we can work out what is going on.
Regards,
Gerard
RE: Dynamically Hiding Groups in Tables
We've re-created the problem in a test harness, with a basic table and three outputs populated from a database. Making column two dynamically hidden (using XPath of true() ) hides the column header and blanks the data in column two, but leaves the actual container on screen.
In the main project we have a web service that can return a different number of fields dependent on the business area that is being queried. The return data can vary in the number of records returned and can potentially be any data type. As each column can potentially be any data type, we are grouping each control, dynamically hiding controls based on the datatype that is returned, and using the groups to dynamically populate the column header/label.
If a group is not populated we wish to hide it.
RE: Dynamically Hiding Groups in Tables
Thanks for the extra detail. I have looked into this further, and think I know what the problem is.
When you enter a hide XPath in this type of scenario WebMaker examines this XPath to try and determine if it is relative or not, ie could it possibly give different results for each row in the table?
If it thinks it is relative, then only the contents of each cell is removed when the XPath result is true, to try and maintain the layout of the table.
Where as if the XPath is absolute then the whole column is removed from the table when the XPath result is true. In this scenario it will always be removing either all the cells in the column, or none.
In you test harness you are using a test condition of +?+?++true()+?+?+?. This will obviously give the same result for every row in the table, but it appears as if this is being partially treated as a relative XPath and so some empty cells are remaining.
If you change this hide XPath to something like +?+?++/*+?+?+? (which will also always be true) you should get the correct behaviour.
I hope this make sense. It does seem like there are some issues with the handling of certain XPaths, but hopefully this will allow you to get the behaviour you need.
Let me know if you have any further questions.
Regards,
Gerard
RE: Dynamically Hiding Groups in Tables
I can confirm that this change does work on our test harness. Unfortunately however, this solution can't be applied to what we are trying to achieve in our main project.
As I said above, we're firing off requests to a WS and getting a response that varies according to business area. Originally, to reduce the amount of Binding we needed to do, we grouped a set of controls. We've now removed the controls from the group and the behaviour remains. We have, for example, a Select with the "Label Value" Bindings of
'/mvc:eForm/mvc :D ata/ns1:GetAddItemSpecResponse/ns1:GetAddItemSpecResult/itemspec/property[1]/@displayname'
and a "Hide If" binding of
'not(/mvc:eForm/mvc :D ata/ns1:GetAddItemSpecResponse/ns1:GetAddItemSpecResult/itemspec/property[1]/@type[. = 'Choice'])'
(there are corresponding controls for checkboxes, text boxes etc - the idea being that only the relevant control is displayed).
These bindings successfully hide the header for the field, but not the actual field itself.
Thanks for your help with this.
RE: Dynamically Hiding Groups in Tables
I think it is probably the use of the not function at the start of the XPath that is confusing the processing and causing the issue.
Can you try changing it so that the 'not' is nested, eg:
/mvc:eForm[not(mvc :D ata/ns1:GetAddItemSpecResponse/ns1:GetAddItemSpecResult/itemspec/property[1]/@type[. = 'Choice'])]
Given that the eForm element is always present, this doesn't change your logic at all, but I'm hoping it will be handled better by WebMaker.
Regards,
Gerard
RE: Dynamically Hiding Groups in Tables
This seems to have resolved the issue we were seeing, though it made my head hurt with some of the ands and ors we are using in the xpath ;-)
RE: Dynamically Hiding Groups in Tables
Those functions are: not(...), true()and false()