Page 1 of 1

Detect columns in Jiwa Grid

PostPosted: Tue Jul 27, 2021 5:44 pm
by SBarnes
Is there a way of telling in a Jiwa Grid which columns are set to visible by the grid manager?

I have to write a custom export screen for a customer and I am looking for a way of determining what columns should go into the output.

I suppose als I would need to turn all the columns back on when the screen loads.

Re: Detect columns in Jiwa Grid  Topic is solved

PostPosted: Tue Jul 27, 2021 6:23 pm
by Mike.Sheen
SBarnes wrote:Is there a way of telling in a Jiwa Grid which columns are set to visible by the grid manager?

I have to write a custom export screen for a customer and I am looking for a way of determining what columns should go into the output.

I suppose als I would need to turn all the columns back on when the screen loads.


Each grid has a property "CustomColumnXML" - if the "Use Custom Columns" context menu item is checked, then this XML is what is applied to the grid. When that is off the "StandardColumnXML" property contains the XML of the column definition when not customised (ie: default as defined by the form code) - so be comparing the two, you can work out which columns have had their visibility, captions and order changed.

Re: Detect columns in Jiwa Grid

PostPosted: Tue Jul 27, 2021 6:38 pm
by SBarnes
Is this XML along similar lines to that used by first result set in a custom tabs stored procedure?

Re: Detect columns in Jiwa Grid

PostPosted: Wed Jul 28, 2021 10:57 am
by Mike.Sheen
SBarnes wrote:Is this XML along similar lines to that used by first result set in a custom tabs stored procedure?


Look and ye shall see.

But no.

Re: Detect columns in Jiwa Grid

PostPosted: Thu Jul 29, 2021 9:41 am
by SBarnes
Thanks Mike

Given that information I think going the Custom Tabs approach is probably easier.

Given I have discovered BuildGridFromDataReader on the JiwaGrid which is public, if I create a table to hold the name of the stored procedures and a meaningful description that the user can choose from on the screen from a combo box when they run it, I can use BuildGridFromDataReader to fill the grid and then just add the rubbish bin button as a column after this and react to the button press to remove rows.

I may need a DataTable behind the scenes for the eventual export to excel to keep track of any rows removed and have an up to date set of rows but the indexes into the datarows should correspond to the grid rows.

It should work and get rid of code needed to setup the grid and any code to display the lines etc which will save a fair bit of time unless you can think of anything that might be a problem?