plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

Datagrid view and edit mode rendering needs a bit of love #6

Closed jean closed 13 years ago

jean commented 13 years ago

When viewing a form with datagrids fields in edit mode, the datagrids should be rendered.

When you select a datagrid row and click the "edit" button, the datagrid form is used in the popup. This form should get the raw field values.

The problem is that the values are set on the URL by javascript during the rendering of the first (parent) form.

The field values should be rendered twice: once for display, and once for the datagrid_edit_row javascript to look at.

jean commented 13 years ago

This needs to be integrated into JQuery dataTable. I gave it a try, but it would take me a long time to figure out.

The problem is that in datagrid_edit_row Plomino uses jq('#' + field_id + '_gridvalue') as the value of the selected row, and adds this to the action of the "edit" button: formurl += '&Plomino_datagrid_rowdata=' + jq.URLEncode(<field_value>);

This is a problem because JQuery uses this value for rendering onscreen as well. We need the datagrid to contain both the values for showing and the real (raw) values. Specifically in the case of references, we store /path/to/document but we have to show "Rendered document title". However the same consideration goes for many other use cases; e.g. currency values (store -1000, display ($1,000.00)).

I.e. in this function Plomino would need to use: jq('#' + field_id + '_gridvalue_raw') to get the value to pass on via the edit action (note the _raw).

Changes required: when creating the dataTable, both the raw and rendered values need to be passed to it. Both the ..._gridvalue (used for display) and ..._gridvalue_raw elements need to be created.

Actually there is probably a better way to solve this using the dataTable API.

ebrehault commented 13 years ago

I agree

ebrehault commented 13 years ago

ok, fixed :)