Cannot use singleton for UltraGridColumn:SortComparer

Posted by Darren Parr on 13-Dec-2012 10:52

Hi

Dont know what Ive done wrong. Initially I wrote a Sortcomparer class to handle sorting date columns which have a datatype of character. This worked well. I just create a class called datecomparer and created a new instance of the class and attached to each column I needed to sort.

This works. As all the functionality is generic and does not vary by column, I created the class as a singleton.

I did it as I have always done it.

ie private constructor. Static public constructor which creates the instance and drops it into a instance property. I then implemented the compare method as required by the icompare interface.

Any ideas why this would not work? MESSAGE datecomparer:instance seems to work fine and always returns the same object.

The error is system.argumentexception: invalid argiment type 15581.

Thanks

Darren.

All Replies

Posted by bronco on 17-Dec-2012 12:37

I'm not sure about the Infragistics requirements, but shouldn't you be using a datetime as datatype?

Posted by Admin on 18-Dec-2012 12:53

Does your object inherit from System.Object?

Posted by Darren Parr on 19-Dec-2012 06:32

Hi

I dont directly inherit from system.object. I thought all my objects inherited from progress.lang.object which inherits from system.object.

I have managed to get around this by removing all the static defs from the class and instead using a factory to create my class. Without the statics it works fine.

HTH

Darren

Posted by Admin on 19-Dec-2012 06:37

In the AVM System.Object inherits FROM Progress.Lang.Object.  not the other way around.

Posted by Darren Parr on 19-Dec-2012 07:05

Oops. Anyway that sorted it. Strange that my object didnt inherit from system.object and it worked with it having no static defs. As soon as you make the constructor static it needs system.object to be able to attach it.

Thanks

Darren

This thread is closed