2 Search Pane for same row

2 Search Pane for same row

antoniocibantoniocib Posts: 277Questions: 62Answers: 1
edited March 2020 in Free community support

It seems strange but it is not, I try to be as clear as possible I need to use the same panes for the same column but only using the if condition I have to sort the data

Eg:

searchPanes:{
columns:[5,3,2 ]
option:[ if (rowData[5] == "Vercelli"){
.draw(); } ]
},

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Can you build a simple example representing what you want to do?

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Kevin if u want i can do a photo, example is impossible cause idk how to do this,okay?

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @antoniocib,

    It sounds like you want to implement SearchPanes with custom options. Take a look at this example showing how to set a variety of different custom options.

    Take a look at this page for more details on how to set these up.

    If this is not what you are after then a photo would be great to try and understand the problem further.

    Hope this helps,
    Sandy

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    its same man!

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1
  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Looks like you have a few issues.

    1. You have targets: [5] twice in columnDefs with both having the option searchPanes. Only one will be used the others are duplicates and will be dropped. The second set you have will not be used.
    2. You have object based data using columns.data but you are trying to access the row data using array syntax. Instead of this:
                           {
                                label: 'VERCELLI',
                                value: function(rowData, rowIdx){
                                    return rowData[5] == 'VERCELLI';
                                }
                            },
    

    You need to use this:

                           {
                                label: 'VERCELLI',
                                value: function(rowData, rowIdx){
                                    return rowData.scarico == 'VERCELLI';
                                }
                            },
    
    1. The columns.searchPanes.options in the second searchPanes is not correct as it expects label/value pairs as shown in the docs.

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Kevin, i need to see the panes with same column how to do?
    Btw works ur way for the first problem.

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    So you want two search panes for one column?

    I don't know of a builtin way to do this. @sandy my be able to provide some options. The only option I can think of is to create a second scarico column and use columns.visible to hide the column. For the second pane use the hidden column.

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    i thinks is the right way this.. i try it, can u do let me a example in live.datatables?

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1
            {
                    visible: false,
                "data": "scarico"
            },
            {
                data: null, render: function ( data, type, row ) {
                return data.scarico+' '+data.scarico_m;
            },
            {
                visible: false,
                "data": "scarico_m"
            },
    

    i used this way but doesnt work

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    Answer ✓
  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1
    edited March 2020

    Ty kevin, works, u r the best as always,now I need to do another thing, i need to change the count column in the pane,so i want to change in with data in my column (EPAL,IND,PERD) can i do this?

    Attack the photo :

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Are you talking about the Cascade Panes feature?

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Mh,no Kevin, the count of column in the searchpane i want to change with my data

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    same:

    searchpane:{
    countColumn: function(row, data){
    return data.epal, data.ind, data.perd
    }
    }

    i improvise the code..

  • sandysandy Posts: 913Questions: 0Answers: 236

    So you want two search panes for one column?

    You are correct Kevin - there is not built in way to do this. We couldn't see why you would need to have two panes for the same column as the functionality would be exactly the same, only taking up more real estate on the page. I would say that if for some reason you want to have two panes for the same column where SearchPanes generates the options then the solution you have given is probably best. If you are going to be adding custom options however, I would suggest that you make use of the documentation I linked above. This will remove the need to duplicate the column and hide it.

    i need to change the count column in the pane

    I think from what I am seeing in the picture you want to change the count column to display the totals of the cells in red, is that correct?

    Thanks,
    Sandy

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    yes @sandy

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    For the question 2 serchpanes for the same column i create this:

        {
                "data": "scarico",
                    visible: false,
            },
            {
                data: null, render: function ( data, type, row ) {
                return data.scarico+' '+data.scarico_m;
             }},
        {
                "data": "scarico_m",
                visible: false,
            },
    

    and

    searchPanes:{
    columns:[5,7]
    },

  • sandysandy Posts: 913Questions: 0Answers: 236

    No, I'm afraid you can't do that when it comes to the count column.

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    mhh, so i need to create a mini table with column 5 and column 7, can u help me?

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1
    edited March 2020

    @kthorngren Kevin ii think only u can help me, i have this 2 query

    select scarico, sum(epal + perd), Sum(ind) From scrivania1 where dlinea !==" " GROUP BY scarico

    select scarico_m, sum(epal + perd), Sum(ind) From scrivania1 where dlinea !== " " GROUP BY scarico_m

    and i need to stamp this in a mini table in a page where already exist the complete table with all data in

This discussion has been closed.