This is a migrated thread and some comments may be shown as answers.
Filter on calculated column doesn't work
3 Answers 42 Views
This is a migrated thread and some comments may be shown as answers.
Ro
Top achievements
Rank 1
Ro asked on 17 Sep 2018, 06:14 PM
Hi there! i'm giving support to a client who has a app developed on cakephp, and for grid they used Kendo ui. I have a table on database with the columns 'periodo', 'nro_beneficio', 'nombre', 'cuil', 'monto_haber' and 'estado'. And the fields 'porcentaje' and 'monto_anterior' are calculated fields. On the grid all fields shows ok, but the filter of the columns "porcentaje" and "monto_anterior" doesn't work. Can you tell me what i'm doing wrong??

$(document).ready(function() {


   var dataSource = new kendo.data.DataSource({
        type: 'json',
        transport: {
            read: {
                url: BASE_URL + '<?php echo $this->Html->url( array("controller" => "reportes", "action" => "haberes.json") ); ?>',
                dataType: 'json'
            },
        },
        filter: {field:'Haberespilotoscabecera.periodo', operator:'eq', value:'<?php if(isset($date)) echo $date; ?>'},
        schema: {
            model: {
                id: 'haber_piloto_detalle_id',

                fields: {
                    periodo: {
                        from: 'Haberespilotoscabecera.periodo',
                        type: 'date'
                    },
                    nro_beneficio: {
                        from: 'Haberespiloto.nro_beneficio',
                        editable: false
                    },                      
                    nombre: {
                        from: 'Piloto.nombre',
                        editable: false
                    },
                    cuil: {
                        from: 'Piloto.cuil',
                        editable: false                 
                    },
                    monto_haber: {
                        from: 'Haberespiloto.monto_haber',
                        editable: false                 
                    },
                    estado: {
                        from: 'Haberespiloto.estado_importacion_haber_id',
                        editable: false         
                    },
                }
            },
            data: 'results',
            total: 'total'
        },
        batch: true,
        serverPaging: true,
        serverSorting: true,
        serverFiltering: true,
        pageSize: 30
    });



    var wnd,detailsTemplate;

    var columns = [
    {
        field: 'Haberespiloto.nro_beneficio',
        title: '<?php echo __("Nro Beneficio"); ?>'
    },{
        field: 'Haberespiloto.numero_legajo',
        title: '<?php echo __("Legajo"); ?>',
        filterable: true
    },{
        field: 'Piloto.name',
        title: '<?php echo __("Nombre"); ?>'

    },{
        field: 'Estadosimportacionhaberespiloto.nombre',
        title: '<?php echo __("Estado"); ?>',
        
    },{
        field: 'Haberespiloto.monto_haber',
        title: '<?php echo __("Monto"); ?>',
        template: '#= kendo.toString(kendo.parseFloat(Haberespiloto.monto_haber), "c") #',
        format: '{0:c}'

    },{
        field: 'monto_anterior',
        title: '<?php echo __("Monto Ant."); ?>',
        template: '#= kendo.toString(kendo.parseFloat(Haberespiloto.monto_anterior), "c") #',
        format: '{0:c}'

    },{
        field: 'porcentaje',
        title: '<?php echo __("Porcentaje"); ?>',
        template: '#= kendo.toString(kendo.parseFloat(Haberespiloto.porcentaje), "p") #',
        format: '{0:p}',
        filterable:

    }];

 
});

3 Answers, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 19 Sep 2018, 12:47 PM
Hi Ro,

Based on the provided description, I believe you should add the "porcentaje" and "monto_anterior" to the "schema.model.fields" with the from property of "Haberespiloto.porcentaje" and "Haberespiloto.monto_anterior" (similar to the other fields). Also, set the type to "number".
I hope this helps.


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ro
Top achievements
Rank 1
answered on 20 Sep 2018, 01:59 PM

Hi!!, thank you so much for your quickly answer!!.
I added those fields to the shema model fields but it's still doesn't work.
Also it shows me this error: SQLSTATE [42522] unknown column Haberespiloto.porcentaje

0
Preslav
Telerik team
answered on 24 Sep 2018, 12:46 PM
Hello Ro,

I checked the provided information again, and unfortunately, I was not able to understand the cause of the described problem.

Having said that, could you please provide an isolated runnable page that clearly replicates and isolates the issue? This will help me better understand the case, and I will be able to provide assistance to the best of my knowledge.


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Ro
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Ro
Top achievements
Rank 1
Share this question
or