simov / express-admin

MySQL, MariaDB, PostgreSQL, SQLite admin for Node.js
MIT License
1.17k stars 223 forks source link

How to format data while showing OneToMany Relations #97

Open ashwanikumar04 opened 8 years ago

ashwanikumar04 commented 8 years ago

Hello:

How can we format the data which is in list or select in case of OneToMany relations with multiple columns.

For example if I have a column

{
                "name": "productId",
                "verbose": "productId",
                "control": {
                    "select": true
                },
                "type": "int(11)",
                "allowNull": true,
                "defaultValue": null,
                "listview": {
                    "show": true
                },
                "editview": {
                    "show": true
                },
                "oneToMany": {
                    "table": "product",
                    "pk": "productId",
                    "columns": [
                        "amount",
                        "code"

                    ]
                }
            }

Here in the oneToMany, columns I want to show two columns, they are shown but without any formatting. Like I want to show Code (amount). How this can be done?

Thanks

simov commented 8 years ago

There is no option for that. The only way would be to intercept the execution via hook and modify the values on your own. If it's something really simple you can modify it using jquery on the client as well.

When developing a hooks just set a breakpoint inside it (debugger) and then use node-inspector to visualize the data structure.