Searchbuilder predefined decimal places

Searchbuilder predefined decimal places

equinox22equinox22 Posts: 17Questions: 5Answers: 0

Morning,

I'm trying to setup a predefined searchbuilder to exclude any rows that have 0.00 (0 alone is not enough as these are financial values). Below is the code that I have.

{
                extend: 'searchBuilder',
                text: 'Search Builder',
                config: {
                    columns: [0, 1, 2, 7, 8, 9],
                    preDefined: {
                        criteria:[
                            {
                                condition: '!=',
                                data: 'Charges',
                                origData: 'cryodecants.costRecovery',
                                type: 'string',
                                value: [0.00]
                            }
                        ],
                        login: 'AND'
                    }                   
                }           
        }

This just returns '0' as the value and doesn't filter for 0.00. I have had a search and not found any questions like this specific to searchbuilder in the past, though some suggestions went along the lines of using render. I've tried adding render: $.fn.dataTable.render.number ( '', '.', 2 ) after value to no avail.

What would be the best way of achieving this?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin
    Answer ✓

    If the value is a string of 0.00 then you would need to use value: ['0.00'] - i.e. make it a string. Otherwise it is jump the number 0, which would always be shortened to 0.

    Allan

  • equinox22equinox22 Posts: 17Questions: 5Answers: 0

    Ah ok - I had tried that earlier but it didn't work. I presumed because it wasn't right, but I also fixed a couple of other things as I changed it to outside the commas. Doh.

    Thanks for steering me back.

Sign In or Register to comment.