DataTables sticky row and custom data
DataTables sticky row and custom data
I'm trying to get my table to always display a specific row as the first child, even when sorting or changing pages.
I got it to work with the sorting (its using an ID column to fix it) but when I change pages, the first row goes away.
I tried using fnDrawCallBack but can't get it to work properly.
Another thing I need is to get that Fixed row to be specific according to a selector.
It works fine for 1-2 options, but my table will have over 90 options to select from, and doing "ifs" for all of those will just be a lot of code... is there a simpler way?
Here is a fiddle: http://jsfiddle.net/3ee390r4/8/
Answers
Ok, I got somewhere
I've updated the fiddle, but I need a better way of displaying that top row if the selector has 90 options.
I'd like this to be cleaner for all possible selections:
$("#table_id > tbody tr:first").before("<tr><td>"+ dataB[0]+"</td><td>"+ dataB[1]+"</td><td>"+ dataB[2]+"</td></tr>");
is there a way of adding that row with the tables correct formatting without doing all those <tr><td>"+ dataB[0]+"</td><td> for every value on the data?
I'll be using a json string for data
http://jsfiddle.net/3ee390r4/14/
There are basically two options for this:
Allan
I tried replacing that string with the fnAddData, but then it just adds an insane amount of data. is there anyway to stop that from happening?
The legacy fnAddData method (or the newer
row.add()
) will insert the row wherever the DataTable deems it should be sorted to, so I'm not sure that would be useful in this case?Allan
oh ok. so the way I did it is how I needs to be.
My problem is that the data on that new roll needs to be calculated and I can't find a way to access the functions required to do those calculations
my problem is that that new roll has some custom data, and the functions to calculate that data are outside the scope..
so I can't figure out how to access those functions
Without being able to see the full page I'm afraid there isn't much help I can offer in that regard.
http://blummstudio.com/mymods
There u go Allan
Thanks - however, I'm afraid I'm not sure what I'm meant to do on that page. It is import / export options and I have no data to import.
Allan
Oh sorry, let me attach a sample.
Copy paste into the import box and hit import, the table I'm having problems with is the on the Optimizer tab
I get some green text saying the data has been imported, but no DataTable. What do I do next? Sorry to ask questions, but this is obviously a new system to me so I'm not familiar with how to use it and in order to offer any help I will need guidance on how to actually see the error.
Allan
Oh, sorry, go to the Optimizer tab and just select a few options and click go. It should populate the table.`
I keep getting "There are no mods matching your preferences for slot 2!".
Can you please give me explicit step by step instructions.