winter: Datatable wrong data-field-name if field name with key, and data dont save
Datatable widget generates wrong attribute data-field-name. In my case, I extend form with fields with keys (data[1][row], data[2][row]), and widget generates name “Report[data[1][row]]”. It’s because of logic on 155 string at DataTable.php file.
Temporary fix it with change string to
$config->fieldName = $this->getParentForm()->arrayName.'['.implode('][', HtmlHelper::nameToArray($this->fieldName)).']';
I took logic from FormField class.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 19 (6 by maintainers)
https://github.com/wintercms/wn-test-plugin/pull/5
@Trysystems could you link the PR here?
@Trysystems I believe it is set up this way because the data table was originally built for the Builder plugin (I believe?) and that’s the format it used. Since it’s been like this for years, it may be difficult to make any changes to the naming without breaking implementations of this data type already out there, but we’ll look into it further.