Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Julian C. 16 posts 73 karma points
    Sep 19, 2017 @ 12:21
    Julian C.
    0

    Courier for grid controls with non-standard properties

    I've inherited a solution from another agency who have created a large number of grid controls in what appears to be a non-standard way.

    Instead of adding new fields within the value property of the control, they have added their own properties directly to the control.

    For example in an editor.html file, instead of using ng-model="control.value.heading" they have used ng-model="control.heading" while control.value is left unused.

    So where the JSON data for one of these controls would normally look like this:

                                {
                                   "value": {
                                        "header": "Feature heading",
                                        ...
                                    },
                                    "editor": {
                                        "alias": "feature"
                                    }
                                }
    

    it instead looks like:

                                {
                                    "value": null,
                                    "editor": {
                                        "alias": "feature"
                                    },
                                    "header": "Feature heading",
                                    ...
                                }
    

    Now I have a problem getting these to work with Courier. Courier uses a model class GridValueControlModel which only has four properties: Config, Editor, Styles and Value. Anything else in the JSON gets dropped, so after copying, the data above gets reduced to:

                                {
                                    "value": null,
                                    "editor": {
                                        "alias": "feature"
                                    },
                                    "config": null,
                                    "styles": null
                                }
    

    The custom properties have been lost.

    I know the correct solution to the problem is to fix the grid controls to use the value property correctly. But I'm faced with about 50 separate plugins to update, and my customer has already started creating content, so I would have to write a migration script to convert all the existing JSON data!

    I can't solve this just by adding my own Courier providers, because the inbuilt one will still run as well, and strip out the non-standard properties anyway. So I'm wondering whether there is a way to disable the inbuilt Courier processing for grid controls completely.

    I've tried adding the grid editor data types to the ignoredDataTypes setting in courier.config, but this hasn't made any difference. The grid content still seem to be deserialised and reserialised by Courier regardless.

    I'm really looking for any other way I might be able to disable Courier processing for grid controls, so I can replace it with my own.

    Thanks in advance for any hints, however obscure!

Please Sign in or register to post replies

Write your reply to:

Draft