(settings)
| 4269 | |
| 4270 | // Update the filtering data for each row if needed (by invalidation or first run) |
| 4271 | function _fnFilterData(settings) { |
| 4272 | var columns = settings.aoColumns |
| 4273 | var data = settings.aoData |
| 4274 | var column |
| 4275 | var j, jen, filterData, cellData, row |
| 4276 | var wasInvalidated = false |
| 4277 | |
| 4278 | for (var rowIdx = 0; rowIdx < data.length; rowIdx++) { |
| 4279 | if (!data[rowIdx]) { |
| 4280 | continue |
| 4281 | } |
| 4282 | |
| 4283 | row = data[rowIdx] |
| 4284 | |
| 4285 | if (!row._aFilterData) { |
| 4286 | filterData = [] |
| 4287 | |
| 4288 | for (j = 0, jen = columns.length; j < jen; j++) { |
| 4289 | column = columns[j] |
| 4290 | |
| 4291 | if (column.bSearchable) { |
| 4292 | cellData = _fnGetCellData(settings, rowIdx, j, "filter") |
| 4293 | |
| 4294 | // Search in DataTables is string based |
| 4295 | if (cellData === null) { |
| 4296 | cellData = "" |
| 4297 | } |
| 4298 | |
| 4299 | if (typeof cellData !== "string" && cellData.toString) { |
| 4300 | cellData = cellData.toString() |
| 4301 | } |
| 4302 | } else { |
| 4303 | cellData = "" |
| 4304 | } |
| 4305 | |
| 4306 | // If it looks like there is an HTML entity in the string, |
| 4307 | // attempt to decode it so sorting works as expected. Note that |
| 4308 | // we could use a single line of jQuery to do this, but the DOM |
| 4309 | // method used here is much faster https://jsperf.com/html-decode |
| 4310 | if (cellData.indexOf && cellData.indexOf("&") !== -1) { |
| 4311 | __filter_div.innerHTML = cellData |
| 4312 | cellData = __filter_div_textContent ? __filter_div.textContent : __filter_div.innerText |
| 4313 | } |
| 4314 | |
| 4315 | if (cellData.replace) { |
| 4316 | cellData = cellData.replace(/[\r\n\u2028]/g, "") |
| 4317 | } |
| 4318 | |
| 4319 | filterData.push(cellData) |
| 4320 | } |
| 4321 | |
| 4322 | row._aFilterData = filterData |
| 4323 | row._sFilterRow = filterData.join(" ") |
| 4324 | wasInvalidated = true |
| 4325 | } |
| 4326 | } |
| 4327 | |
| 4328 | return wasInvalidated |
no test coverage detected