Display a column instead of a row

Display a column instead of a row

you2525you2525 Posts: 7Questions: 1Answers: 0

Hi,

I am searching this for a long time and I found nothing.

I would like to display a column instead of a row after searching for something.

For example, when i search 'Satou' here , i would like to see all the column Name because Airi Satou belong to the column Name ( instead of seeing the row for the Name/ Position/Office/etc. )

I'm really stuck, i really appreciate some helps, thank you :)

This question has accepted answers - jump to:

Answers

  • anuragsharmaanuragsharma Posts: 1Questions: 0Answers: 0

    when i search a website then that site is unable to lack of datatable please help me please

  • you2525you2525 Posts: 7Questions: 1Answers: 0

    Maybe it is better if you post your question in a post of its own, with more details of your problem, just the button "ask a question" for a new topic

  • colincolin Posts: 8,085Questions: 0Answers: 1,357
    Answer ✓

    @you2525 That's not possible by default, I'm afraid, but you could create your own filter to do that.

    You would get the column data for each column with column().data(), filter it with filter() (there's an example on that page doing just this), then hide columns that don't match with column().visible(). It shouldn't be too tricky

    Colin

  • you2525you2525 Posts: 7Questions: 1Answers: 0

    Ok, i think i understand what you mean theoretically, but, i'm a newbie... specially in js.
    Can you show me more in details how can i do it ? or a example somewhere else... ?
    someting more pratical to combine all of these functions ?

    I'm thinking maybe there is another way to do it (because maybe this is too difficult for me), i have the same table but the rows=columns, so the result of the search by row is fine here. Do you think i can use this table to search and then display the result (originally in rows) by column ? ( so only play on the display and not with the search method) if yes, i don't know how to play on the display iike this, if you have a idea, i'm interested too :)
    Thank you

  • you2525you2525 Posts: 7Questions: 1Answers: 0

    (my proposition seems to be not possible)

  • kthorngrenkthorngren Posts: 8,199Questions: 25Answers: 1,844
    Answer ✓

    Colin's response is the way to do this. Sounds like an interesting idea so put together a simple example for you.
    http://live.datatables.net/lakomafi/1/edit

    In addition to the API's Colin mentioned you will want to look at columns().every() and count(). I used the dom option to show just the Datable search input and table. I removed the Datatables event listeners from the search input and create my own.

    The search behaves close to the Smart search capabilities documented in the search() API docs.

    HTH,
    Kevin

  • you2525you2525 Posts: 7Questions: 1Answers: 0

    Thank you so much for your help, i adapted your example to my code and it works great ! :) :) :)
    (and i understand what i do aha, perfect)

  • kthorngrenkthorngren Posts: 8,199Questions: 25Answers: 1,844

    Great, glad it was useful for you!

    Kevin

Sign In or Register to comment.