I have a column with text and a small icon beside the text.
The text is one property in the data object. The URL to the icon is another property in the data object.Example object:{TextProperty: "Some Text", ImageProperty: "/images/image.jpg"}Column definition:{ headerText: "Header", key: "TextProperty", dataType: "string", template: "<img src = ${ImageProperty}></img> ${TextProperty}" }
The problem here, is that with TextProperty as the key ImageProperty does not exist. If I view source once the column is rendered I see that ImageProperty is set to "(unknown)". Likewise, if I use the ImageProperty as the key the TextProperty is not found.
To solve this, I moved both properties in a container object and changed the dataType in the column definition to object.Example object:{ContainerObject: {TextProperty: "Some Text",ImageProperty: "/images/image.jpg"}}Column definition:{headerText: "Header",key: "ContainerObject",dataType: "object",template: "<img src = ${ContainerObject.ImageProperty}></img> ${ContainerObject.TextProperty}"}
In this way the entire container object is now bound and data exists for both the image and the text - exactly what I want.
But a new problem arises, which is that filtering no longer works on this column.In summary:
I also tried overriding toString() on ContainerObject to see if filtering was perhaps using toString(), but this did nothing.How can I create a column definition that uses two properties on the data object, but also allows filtering?
Yes, it's weird. Anyway, did it help you or you need further assistance?
It's weird. It looks like someone copy/pasted my post, and then their post got replies (despite mine being first?).
Hello Dave,
I believe that the same scenario is already requested in another forum thread as well. Here is the forum thread: https://ko.infragistics.com/community/forums/f/ignite-ui-for-javascript/111963/filtering. Please refer to it and I would ask to not duplicate your questions, because the forum thread is an open community and your questions are visible from everyone and everyone could participate in the current discussion. We've already addressed your issue and we're working on it. I suggest you to follow another forum thread where our colleague Vasil has already answered.
If you need further assistance, please let me know.
Regards,Tsanna
hi