Save items of UltraListView

Posted by jmls on 24-Mar-2010 16:06

I've scoured the documentation, but to no avail.

Is there any mechanism for saving the listitems of a ListView to either a file or char variable ?

Julian

All Replies

Posted by jmls on 25-Mar-2010 02:45

While I'm at it, how do I sort the items ?? Frustration, thy name is Infragistics

Posted by agent_008_nl on 25-Mar-2010 03:58

I found this not so difficult to find out. It did cost some time, yes. Use the infragisticssite, google, the classbrowser and your imagination.

The code snippets could help you:

using Infragistics.Win.UltraWinListView.*

using System.Drawing.* from assembly.

define private variable hImageFolderOpen      as Image                         no-undo.

create images in this way:

hImageFolderOpen   = cast(new Bitmap(search('ofold.ico')), Image)

      define variable hItem               as UltraListViewItem          no-undo.

      DEFINE VARIABLE SubItemColumn       AS UltraListViewSubItemColumn NO-UNDO.

      DEFINE VARIABLE SubItem             AS UltraListViewSubItem       extent 2 NO-UNDO.

I have a listview with one 'MainColumn' and two 'SubItemColumns'

            assign UltraListView:MainColumn:Text  = "Caption"

                   listview:MainColumn:Width = 100

                   SubItemColumn             = NEW UltraListViewSubItemColumn()

                   SubItemColumn:Width       = 300                            

                   SubItemColumn:Text        = "Action".

            UltraListView:SubItemColumns:Add(SubItemColumn).

            assign SubItemColumn            = NEW UltraListViewSubItemColumn()

                   SubItemColumn:Width      = 200                            

                   SubItemColumn:Text       = "Menutype".

            UltraListView:SubItemColumns:Add(SubItemColumn).

Now add items and subitems:

        for each

            by OrderField

            on error undo, throw:

            assign 

                subItem[1]                = new UltraListViewSubItem()

                subItem[1]:Value          = some text

                subItem[2]                = new UltraListViewSubItem()

                subItem[2]:Value          = some other text               

                hItem                     = new UltraListViewItem(hObject, SubItem)

                hItem:Value               = some Caption

                hItem:Appearance:Image    = hImageControl

                hItem:Key                 = some unique key

            listview:Items:add(hItem).

         end. 

--

Kind regards,

Stefan Houtzager

Houtzager ICT consultancy & development

www.linkedin.com/in/stefanhoutzager

Posted by jmls on 25-Mar-2010 05:05

Thanks Stefan ,

What I was really after was a method to serialise the data, rather

than running through each item and adding to a char list (much like

WRITE-JSON on a temp-table)

It seems as if there aren't any.

Julian

On 25 March 2010 08:58, Stefan Houtzager

Posted by agent_008_nl on 25-Mar-2010 08:52

Ah, ok Julian, maybe you can ask on the infragisticsforum/do an enhancement request there. You saw the SaveAsXml/LoadFromXml methods in the classbrowser?

METHOD PUBLIC FINAL void SaveAsXml (filename AS  character)

Member of Infragistics.Win.UltraWinListView.UltraListView

Summary:
Saves  Infragistics.Win.UltraWinListView.UltraListView data into the specified file in  XML (Soap) format.

Parameters:

  • filename: The name of the file to write.

  • METHOD PUBLIC FINAL void LoadFromXml (filename  AS character)

    Member of Infragistics.Win.UltraWinListView.UltraListView

    Summary:
    Loads  Infragistics.Win.UltraWinListView.UltraListView data from the specified file  previously saved in XML (Soap) format.

--

Kind regards,

Stefan Houtzager

Houtzager ICT consultancy & development

www.linkedin.com/in/stefanhoutzager

Posted by jmls on 25-Mar-2010 09:00

I did, and discounted it because I thought that it contained all the

layout and settings for the control - but on close inspection of the

xml file, it seems to also include the actual items themselves

On 25 March 2010 13:52, Stefan Houtzager

Posted by jquerijero on 26-Mar-2010 14:52

You normally implement this by wrapping UltraListView and inheriting from ISerializable, but the implementation requires attirbute which is not supported by OE Architect.

This thread is closed