Column Type

Column Type

samsamtestsamsamtest Posts: 52Questions: 15Answers: 1

Hi I need some help.

What type of column types can I select ?
Is it posible to say if a column is integer, Decimals, Text, Procent etc.
I read here Column-type that if I use server side that its not possible ?
Thanks kind
Sam

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,311Questions: 26Answers: 4,948
    Answer ✓

    The column type is used for sorting purposes. When using client side processing Datatables automatically sets the type by looking at the data in each column. If all the data is of a particular type it will set the column to that. For example if there is a column of numbers it will set to the num type but if there happen to be other types of data in that column it won't set it to num. Forcing it to num with columns.type won't help the soritng.

    As you noted in the docs:

    Please note that if you are using server-side processing (serverSide) this option has no effect since the ordering and search actions are performed by a server-side script.

    In this case sorting is performed by the server and Datatables displays the table in the order returned from the server.

    Is there a particular issue you are trying to solve?

    Kevin

  • samsamtestsamsamtest Posts: 52Questions: 15Answers: 1

    Hi, thanks for te quick respons,
    Yes it is example in one column we have the month 01, 02, 03, 04 etc. But when it comes to the table it changes to 1. I am able to take way the number_format and round from the php code but then all the number will have decimals etc. The data we have can be mixed etc. So I am trying to build a select were you can selet what type of data column 1 is etc.

    And that I want have the possibility to say if it is going to be on the left or right side etc..

  • samsamtestsamsamtest Posts: 52Questions: 15Answers: 1

    I HAVE SOLVED THIS BY CREATING WHAT TYPE OF COLUMNS I HAVE. IN PH SOURCE LEVEL WITH TWIG ETC.

           {
            "ProductNo": {
                "type": "text"
            },
            "Description": {
                "type": "text"
            },
    
            "Category": {
                "type": "text"
            },
    
            "CategoryDescription": {
                "type": "text"
            },
    
            "Stock": {
            "type": "decimals",
                "decimals": 2,
                "thousand_sep": " ",
                "decimal_point": ".",
                "alignment":"right"
            },
    
            "QuantityInOrder": {
            "type": "decimals",
                "decimals": 2,
                "thousand_sep": " ",
                "decimal_point": ".",
                "alignment":"right"
            },
    
    
            "QuantityInPurchase": {
            "type": "decimals",
                "decimals": 2,
                "thousand_sep": " ",
                "decimal_point": ".",
                "alignment":"right"
            },
    
    
            "AverageCostPrice": {
                "type": "decimals",
                "decimals": 2,
                "thousand_sep": " ",
                "decimal_point": ".",
                "alignment":"right"
            },
    
    
            "StandardPrice": {
                "type": "decimals",
                "decimals": 2,
                "thousand_sep": " ",
                "decimal_point": ".",
                "alignment":"right"
            },
    
    
            "Price": {
            "type": "decimals",
                "decimals": 2,
                "thousand_sep": " ",
                "decimal_point": ".",
                "alignment":"right"
            },
    
    
            "LastMovementDate": {
                "type": "date"
            },
            "ProductGroup1": {
                "type": "text"
    
            }
         }
    
This discussion has been closed.