Posted 16 Oct 2017
Link to this post
Come on! I can't upload the zip file because the form of the forum crash...
Sorry but I'm desperate now so I'm going to paste the code here...
// THIS IS THE JSONSTRING RETURNED BY THE DATA SOURCE TRANSPORT
[
{
"_sattoci_id":1,
"_sattoci_max":0
},{
"_sattoci_id":2, // This is what I'm getting
"_sattoci_max":0.16 // This is the value I expect when I finalize editing mode
}
]
// CUSTOM EDITOR
function ivaEditor(container, options) {
$('<input name="' + options.field + '" />')
.appendTo(container)
.kendoDropDownList({
// When avalue primitive is false there's no difference
// valuePrimitive: false,
valuePrimitive: true,
optionLabel: "SIN IVA",
autoBind: true,
dataValueField: "_sattoci_id",
dataTextField: "_sattoci_max",
dataSource: {
transport: {
read: "/api/SatCatTasasImpuestos/ivaT",
dataType: "json",
}
}
});
}
var conceptosGridData = new kendo.data.DataSource({
schema: {
model: {
id: "cve_producto",
fields: {
cta_predial: {type:"string", nullable:true},
no_pedimento: {type:"string", nullable:true},
// I've remove nullable from column definition because some people suggest to do so
// iva: {type:"string", nullable:true},
iva: {type:"string"},
}
}
}
});
var conceptosGrid = $("#grid-conceptos").kendoGrid({
dataSource: conceptosGridData,
save: onSave,
height: 350,
scrollable: true,
resizable: true,
columns:[{
width: 150,
editor: ivaEditor,
field: "iva",
title: "IVA"
// This alternative shows undefined
// template: "#=iva._sattoci_max#",
// This alternative shows the value instead of the text
// template: "#=iva#",
}],
editable: "inline"
}).data("kendoGrid");