field type "datatable" not showing selected values
field type "datatable" not showing selected values
u01sfa3
Posts: 4Questions: 1Answers: 0
Hello,
I am using .NET Editor v2.0.5 and have a multi-select box. When the type of this is datatable, the selected values aren't displayed in the editor panel. If I switch the type from datatable to **select **or **checkbox **shows the correct selected values.
{
"label": "Categories:",
"name": "Categories[].id",
"type": "datatable",
"multiple": true
}
This question has an accepted answers - jump to answer
Answers
Can you give me a link to your page showing the issue so I can debug it please? If that isn't possible can you use the debugger to give me a trace please - click the Upload button and then let me know what the debug code is.
Allan
Hi Allan,
Thanks for getting back to me. The page isn't public facing but I have uploaded the debugger information, code: urizoz. Let me know if that's all you need?
That's really useful - thank you. I can see in it that the response from the server for the data in a row looks like:
While for the options it is:
Note that the
id
property for the row is a string, while for the options it is an integer. I strongly suspect that is the issue since we use strict typing for the DataTable.How are you populating the JSON reply from the server?
Allan
Hi Allan,
categories are populated in the controller as:
Would it be useful to have the full model & controller code?
I appreciate your help with this.
I actually had exactly the same error in my Mjoin example for .NET - apologies for that.
The error is in the
JoinAccessModel
- it should be:The error was being caused by the
id
property being marked as astring
. If you change it toint
then it should spring into action!Regards,
Allan
Hi Allan,
That's great, thanks for your help with this. Much appreciated