Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text_data_delimiter on range_number_slider #580

Closed
wynstep opened this issue Jun 10, 2019 · 6 comments
Closed

text_data_delimiter on range_number_slider #580

wynstep opened this issue Jun 10, 2019 · 6 comments

Comments

@wynstep
Copy link

wynstep commented Jun 10, 2019

Hello!
I have a table containing a column with different numbers separated by comma (eg. 12,34,56,78). When I use the filter_type = "multi-select" and text_data_delimiter = "," it works but it's not working with the range number slider.

Is there any chance to make this filter working for selecting numeric values separated by comma?

Many thanks

@vedmack
Copy link
Owner

vedmack commented Jun 12, 2019

Hi

Please provide a jsfiddle test page, use this for a start https://jsfiddle.net/vedmack/t09q871w/

@wynstep
Copy link
Author

wynstep commented Jun 12, 2019

Hi @vedmack, I reproduced the bug into this fiddle.

Latest versions of jquery, datatables and beta version of yadcf

https://jsfiddle.net/wynstep/nvoru7hc/

Thanks!

@vedmack
Copy link
Owner

vedmack commented Jun 15, 2019

Hi

Please take a look at the following test page, and let me know what do you think

https://jsfiddle.net/vedmack/qko6nd4y/9/

@wynstep
Copy link
Author

wynstep commented Jun 16, 2019

@vedmack Hi and thanks for your kind help!
According to the jsfiddle, the filter still seems not working as expected. I would like the filter to work if any of the values in the row (comma-separated) are included in the numeric range.

vedmack added a commit that referenced this issue Jun 19, 2019
Added range_data_type: 'delimiter' , to allow range slider filter to handle multiple values per cell - #580
@vedmack
Copy link
Owner

vedmack commented Jun 19, 2019

Hi,

grab 0.9.4.beta.29,
I have added range_data_type: 'delimiter'

yadcf.init(tTable, [{
  column_number: 2,
  filter_type: "range_number_slider",
  text_data_delimiter: ",",
  range_data_type: 'delimiter'
}]);

https://jsfiddle.net/vedmack/qko6nd4y/

@vedmack vedmack closed this as completed Jun 19, 2019
@SSzretter
Copy link

I need the delimiter for range_number as well and was able to get it to work by using this code change starting at like 1557 - not sure if this would break the range slider but it allows range_number to work with the deliminer.

else if (columnObj.range_data_type === 'delimiter') { if (columnObj.text_data_delimiter !== undefined) { let valSplitted = val.split(columnObj.text_data_delimiter); let anyNumberInRange = function (fromToObj) { return function (element, index, array) { if (min === "" && max === "") { retVal = true; } else if (min === "" && element <= max) { retVal = true; } else if (min <= element && "" === max) { retVal = true; } else if (min <= element && element <= max) { retVal = true; } return retVal; //return element >= fromToObj.from && element <= fromToObj.to; }; }; retVal = valSplitted.some(anyNumberInRange({ from: min, to: max })); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants