Freeze A Row of Data

Freeze A Row of Data

DarioAustraliaDarioAustralia Posts: 4Questions: 2Answers: 0

Is there a way to freeze the first row of data, so that it won't be sorted when a column heading is clicked ? Here is an example of when that could be useful :

Prediction Method Error Rate Accuracy
Ideal 0 1
SVM 0.21 0.88
ANN 0.28 0.84
LDA 0.33 0.74

No matter what column I sort on, I'd like the Ideal row to always be at the top of the table.

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    You would need to create a custom sorting plug-in that will always put that row at the top. The other option is to do an DOM injection in the draw callback, but that has its own complications (FixedColumns for example simply will not work with it)!

    Allan

  • DarioAustraliaDarioAustralia Posts: 4Questions: 2Answers: 0

    I'm not sure that I could achieve that. I'm using the DT R package as an interface to DataTables and I haven't programmed with JavaScript before. I think that I can go without the feature.

This discussion has been closed.