yadcf icon indicating copy to clipboard operation
yadcf copied to clipboard

Range filters don't work with function properties

Open cpdog opened this issue 4 years ago • 1 comments

See: http://live.datatables.net/ziqipodu/1

Note that the property "doubleAge" is defined as a function. DataTables will execute the function to retrieve the property value. For the "select" filter type, yadcf works properly and filters the data properly. For the range filters however, yadcf doesn't filter at all.

This appears to be because the dot2obj function has the following code

	dot_refs = dot_refs.split(".");
	for (i = 0; i < dot_refs.length; i++) {
		if (tmpObj[dot_refs[i]] !== undefined && tmpObj[dot_refs[i]] !== null) {
			tmpObj = tmpObj[dot_refs[i]];
		} else {
			return '';
		}
	}

This doesn't consider that a property may be a function. Consequently, the filter is comparing against the function definition rather than the result of the function invocation.

cpdog avatar Jun 25 '20 01:06 cpdog

@vedmack let me know if you need any more info about this bug or if I messed up the PR.

cpdog avatar Oct 19 '20 21:10 cpdog