jquery datatable hide column by name

jquery datatable hide column by name

sarveshkushwahasarveshkushwaha Posts: 8Questions: 1Answers: 0
edited January 2014 in DataTables 1.9
Hi All ,

I really love this plugin ..its simply awesome. i am new to it .. so please tell me how can i hide whole column by its name . tried to google this but just found following code and similar things : -
this.fnSetColumnVis(5, true);

Please help , Thanks :) .

Replies

  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    What do you mean "its name"? Are you using sName or are you using the HTML content as the name / title? Eitherway, you need to convert the 'name' into a column index, which you pass into fnSetColumnVis .

    Allan
  • sarveshkushwahasarveshkushwaha Posts: 8Questions: 1Answers: 0
    Hi allan thanks for replying ...by its name means ..can i hide a column by its column name ???
  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    As I asked, what do you mean by its name? Do you mean the HTML contents of the header cell? If so, then yes - use jQuery to get the cell's index using the `:contains()` selector and the `index()` method.
  • sarveshkushwahasarveshkushwaha Posts: 8Questions: 1Answers: 0
    Thanks allan :)
This discussion has been closed.