简体   繁体   中英

Is it possible to use yadcf “ranger_number_slider” in server side processed datatables?

I need some help. I have a server side processed jquery.datatable. One of the columns is a numeric col with values between 0 and 180.

I would like to filter this column with yadcf ranger_number_slider. I set the yadcf like this:

{
       column_number: 14,
       filter_type: 'range_number_slider',
       filter_container_id: 'external_filter_container_ZZ'
}

But I am faced with some problems: On the first page of the datatable (paging size is 10, number of entries is roundabout 10.000), the values of this specific column are (accidentally) only from 0 to 30. The ranger_number_slider shown in the div "external_filter_container_ZZ" is as shown below:

Ranger-Number-Slider

As you see in the image, the slider is set from 0 on the left side to 30 on the right side. It seems, that the slider doesn´t get all values from the server side processing for this specific column.

Furthermore: If I try to select some values in the slider, the result in the table is always empty, and the slider disappears!

Is anybody able to give some hints for this behaviour?

Thank you very much in advance.

Best regards BeSt

Not only that its possible, its available on the showcase page - see here , you must do some reading in the docs / showcase (source on github too) and you will find all the needed docs for that, in short: in addition to your table data that is sent form server to client you must provide yadcf with its data as well - populate the yadcf_data_COL_NUM with the relevant data,

aaData:[["Trident", "Internet Explorer 4.0", "Win 95+", "7/24/2015", "1"],…]
draw:"2"
recordsFiltered:6
recordsTotal:57
yadcf_data_0:[{value: "Trident", label: "Trident Eng'"}, {value: "Tasman", label: "Tasman Eng'"},…]
yadcf_data_1:["Nintendo DS browser", "Netscape Browser 8", "All others", "Lynx", "Mozilla 1.6", "Mozilla 1.5",…]
yadcf_data_2:["N800", "Win 95+ / Mac OS 8.6-9.2", "S60", "KDE 3.5", "Win XP SP2+", "KDE 3.3", "OSX.3", "KDE 3.1",…]
yadcf_data_4:["134", "0"] <- this is for range slider filter tips

From showcase docs

//In case that you want to populate your select / auto_complete filters with values //you have to add to your current JSON the following attributes yadcf_data_0 / yadcf_data_1 / etc' //where each attribute contains a list of strings //For example: //"yadcf_data_0":["KHTML","Webkit","Trident","Misc","Other browsers","Tasman","Presto","Gecko"],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM