Using the latest SmartClientJS 13, I'm trying to create a DynamicForm field for payment methods. I have the payment methods in a static array, similar to this (simplified) example:
I want to show a pick list with two columns: "name" and "percentage".
I've managed to get this working by defining the field similar to this:
I must include the "valueMap" property, else no data gets shown and the scroll bar suggests there's lots of data.
The question is, is this the right way of doing this? So I don't want server side data and I can't use just a valueMap, since I need to display the extra "percentage" value. An alternative solution is create an optionDataSource instance of type isc.DataSource with "cacheData" and "clientOnly" = true, but this seems a bit overkill.
Code:
const methods = [ { code: 'credit_card', name: 'Credit Card', percentage: 3 }, { code: 'debit_card', name: 'Debit Card', percentage: 1 } ];
I've managed to get this working by defining the field similar to this:
Code:
{ displayField: 'name', editorType: 'SelectItem', getClientPickListData: function () { return methods; }, name: 'payment_method_code', pickListFields: [ { name: 'name', title: 'Name', type: 'text' }, { name: 'percentage', title: 'Percentage', type: 'float', width: 80 } ], pickListWidth: 240, title: 'Payment method', valueField: 'code', valueMap: methods.getValueMap('code', 'name'), width: '*' }
The question is, is this the right way of doing this? So I don't want server side data and I can't use just a valueMap, since I need to display the extra "percentage" value. An alternative solution is create an optionDataSource instance of type isc.DataSource with "cacheData" and "clientOnly" = true, but this seems a bit overkill.
Comment