1(function() { 2var GridHeaderFilterMode = { List: 1, CheckedList: 2, DateRangePicker: 3, DateRangeCalendar: 4, NumericRangePicker: 5 }; 3var GridFilterHelper = ASPx.CreateClass(null, { 4 constructor: function(grid) { 5 this.grid = grid; 6 this.activeElement = null; 7 this.lockFilter = true; 8 this.searchFilterTimer = -1; 9 this.searchEditorInitialValue = undefined; 10 this.savedSearchEditorValue_beforeCallback = undefined; 11 this.searchEditorLastClientValue = undefined; 12 this.searchEditorValueChangedOnCallbackWaiting = false; 13 this.initialHeaderFilterPopupMinWidth = null; 14 this.headerFilterPopupWithButtonPanelMinWidth = null; 15 this.headerFilterPopupRelatedColumn = null; 16 this.headerFilterPopupDimensions = { }; 17 this.headerFilterColumnIndicesToInitialize = [ ]; 18 this.initialHeaderFilterState = { }; 19 this.SearchEditorKeyDownHandler = this.OnSearchEditorKeyDown.bind(this); 20 this.SearchEditorValueChangedHandler = this.OnSearchEditorValueChanged.bind(this); 21 this.SearchEditorUserInputHandler = this.OnSearchEditorUserInput.bind(this); 22 this.HeaderFilterPopup_PopUpHandler = this.OnHeaderFilterPopup_PopUp.bind(this); 23 this.HeaderFilterPopup_CloseUpHandler = this.OnHeaderFilterPopup_CloseUp.bind(this); 24 this.HeaderFilterPopup_ResizeHandler = this.OnHeaderFilterPopup_Resize.bind(this); 25 ASPx.GetControlCollection().ControlsInitialized.AddHandler(this.OnControlsInitialized, this); 26 }, 27 Reset: function() { 28 this.initialHeaderFilterState = { }; 29 }, 30 IsFilterLocked: function() { return this.lockFilter; }, 31 LockFilter: function() { this.lockFilter = true; }, 32 UnlockFilter: function() { this.lockFilter = false; }, 33 GetActiveElement: function() { return this.activeElement; }, 34 ResetActiveElement: function() { this.activeElement = null; }, 35 IsValidInstance: function() { return this.grid.IsValidInstance(); }, 36 GetAllowSearchFilterTimer: function() { return this.grid.allowSearchFilterTimer; }, 37 GetSearchFilterDelay: function() { return this.grid.searchFilterDelay; }, 38 GetEnableAccessibility: function() { return this.grid.accessibilityCompliant; }, 39 ResolveColumnIndex: function(id) { return this.grid.getColumnIndex(id); }, 40 GetSearchEditor: function() { return this.grid.GetSearchEditor(); }, 41 GetCustomSearchPanelEditor: function() { return this.grid.GetCustomSearchPanelEditor(); }, 42 GetSearchPanelFilter: function() { return this.grid.searchPanelFilter; }, 43 ApplySearchPanelFilter: function(value) { this.grid.ApplySearchPanelFilter(value, true); }, 44 GetContentTable: function() { return this.grid.GetMainTable(); }, 45 OnInit: function() { 46 this.LockFilter(); 47 window.setTimeout(function() { this.UnlockFilter(); }.bind(this), 0); 48 this.EnsureSearchEditor(); 49 window.setTimeout(function() { this.SaveFilterEditorsState(); }.bind(this), 0); 50 window.setTimeout(this.InitializeHeaderFilterPopup.bind(this), 0); 51 }, 52 OnAfterCallback: function() { 53 this.LockFilter(); 54 window.setTimeout(function() { this.UnlockFilter(); }.bind(this), 0); 55 this.EnsureSearchEditor(); 56 window.setTimeout(function() { this.SaveFilterEditorsState(); }.bind(this), 0); 57 window.setTimeout(this.InitializeHeaderFilterPopup.bind(this), 0); 58 }, 59 OnBeforeCallback: function() { 60 this.LockFilter(); 61 this.UnloadHeaderFilterPopup(); 62 var edit = this.GetSearchEditor(); 63 if(edit) 64 this.savedSearchEditorValue_beforeCallback = this.GetEditorStringValue(edit); 65 }, 66 OnCancelCallbackCore: function() { 67 this.UnlockFilter(); 68 this.InitializeHeaderFilterPopup(); 69 }, 70 SaveFilterEditorsState: function() { }, 71 ClearFilterEditorsState: function() { }, 72 OnDispose: function() { 73 ASPx.GetControlCollection().ControlsInitialized.RemoveHandler(this.OnControlsInitialized, this); 74 }, 75 LoadSearchEditorValueOnCallback: function() { 76 var edit = this.GetSearchEditor(); 77 if(edit) { 78 var value = this.GetEditorStringValue(edit); 79 this.searchEditorValueChangedOnCallbackWaiting = value !== this.savedSearchEditorValue_beforeCallback; 80 this.searchEditorLastClientValue = value; 81 this.savedSearchEditorValue_beforeCallback = undefined; 82 } 83 }, 84 SetSearchPanelCustomEditor: function(editor) { 85 if(!ASPx.Ident.IsASPxClientEdit(editor) || !editor.GetMainElement()) 86 return; 87 if(this.grid.customSearchPanelEditorID === editor.name) 88 return; 89 this.RemoveSearchEditorEvents(this.GetSearchEditor()); 90 this.grid.customSearchPanelEditorID = editor.name; 91 this.EnsureSearchEditor(); 92 }, 93 AssignSearchEditorEvents: function(edit) { 94 if(edit.dxgvFilterHelper === this) 95 return; 96 if(edit.KeyDown) 97 edit.KeyDown.AddHandler(this.SearchEditorKeyDownHandler); 98 if(edit.ValueChanged) 99 edit.ValueChanged.AddHandler(this.SearchEditorValueChangedHandler); 100 if(edit.UserInput) 101 edit.UserInput.AddHandler(this.SearchEditorUserInputHandler); 102 edit.dxgvFilterHelper = this; 103 }, 104 RemoveSearchEditorEvents: function(edit) { 105 if(!edit || edit.dxgvFilterHelper !== this) 106 return; 107 if(edit.KeyDown) 108 edit.KeyDown.RemoveHandler(this.SearchEditorKeyDownHandler); 109 if(edit.ValueChanged) 110 edit.ValueChanged.RemoveHandler(this.SearchEditorValueChangedHandler); 111 if(edit.UserInput) 112 edit.UserInput.RemoveHandler(this.SearchEditorUserInputHandler); 113 delete edit.dxgvFilterHelper; 114 }, 115 EnsureSearchEditor: function() { 116 var edit = this.GetSearchEditor(); 117 if(!edit) return; 118 this.AssignSearchEditorEvents(edit); 119 var isCustomEditor = edit === this.GetCustomSearchPanelEditor(); 120 this.searchEditorInitialValue = isCustomEditor ? this.GetSearchPanelFilter() : this.GetEditorStringValue(edit); 121 var applySearchValueOnCallback = this.searchEditorValueChangedOnCallbackWaiting && this.searchEditorInitialValue !== this.searchEditorLastClientValue; 122 if(applySearchValueOnCallback) { 123 window.setTimeout(function() { 124 edit.SetValue(this.searchEditorLastClientValue);
125 this.ApplySearchFilterFromEditor(edit); 126 }.bind(this), 0); 127 } else { 128 if(isCustomEditor) 129 window.setTimeout(function() { edit.SetValue(this.GetSearchPanelFilter()); }.bind(this), 0); 130 } 131 this.searchEditorValueChangedOnCallbackWaiting = false; 132 }, 133 GetEditorStringValue: function(edit) { 134 var value = edit.GetValueString(); 135 return ASPx.IsExists(value) ? value : ""; 136 }, 137 OnSearchEditorKeyDown: function(s, e) { 138 if(!e.htmlEvent || !this.IsValidInstance()) 139 return; 140 e = e.htmlEvent; 141 var clearEditor = e.keyCode == ASPx.Key.Delete && e.ctrlKey; 142 if(e.keyCode == ASPx.Key.Enter || clearEditor) { 143 if(clearEditor) 144 s.SetValue(null); 145 this.ApplySearchFilterFromEditor(s); 146 ASPx.Evt.PreventEventAndBubble(e); 147 return; 148 } 149 this.CreateSearchFilterTimer(s); 150 }, 151 OnSearchEditorUserInput: function(s, e) { 152 if(!this.IsValidInstance() || this.IsSearchFilterTimerActive()) 153 return; 154 this.OnSearchEditorOnPaste(s); 155 }, 156 OnSearchEditorOnPaste: function(editor) { 157 this.EnsureEditorRawValue(editor); 158 this.CreateSearchFilterTimer(editor); 159 }, 160 OnSearchEditorValueChanged: function(s, e) { 161 if(!this.IsValidInstance()) 162 return; 163 window.setTimeout(function() { this.ApplySearchFilterFromEditor(s); }.bind(this), 0); 164 }, 165 IsSearchFilterTimerActive: function() { 166 return this.searchFilterTimer !== -1; 167 }, 168 CreateSearchFilterTimer: function(editor) { 169 if(!this.GetAllowSearchFilterTimer()) return; 170 this.ClearSearchFilterTimer(); 171 this.searchFilterTimer = window.setTimeout(function() { this.ApplySearchFilterFromEditor(editor); }.bind(this), this.GetSearchFilterDelay()); 172 }, 173 ClearSearchFilterTimer: function() { 174 this.searchFilterTimer = ASPx.Timer.ClearTimer(this.searchFilterTimer); 175 }, 176 ApplySearchFilterFromEditor: function(edit) { 177 this.ClearSearchFilterTimer(); 178 if(this.IsFilterLocked()) return; 179 if(!edit || !this.GetContentTable()) 180 return; 181 edit.Validate(); 182 if(!edit.GetIsValid()) 183 return; 184 var value = this.GetEditorStringValue(edit); 185 if(value === this.searchEditorInitialValue) 186 return; 187 this.SaveFilterEditorActiveElement(edit); 188 this.ApplySearchPanelFilter(value); 189 }, 190 EnsureEditorRawValue: function(edit) { 191 if(ASPx.GetFocusedEditor() === edit && edit.SyncRawValueIfHasTextDecorators) { 192 edit.SyncRawValueIfHasTextDecorators(); 193 } 194 }, 195 SaveFilterEditorActiveElement: function(editor) { 196 if(!editor) return; 197 var columnIndex = this.ResolveColumnIndex(editor.name); 198 if(columnIndex < 0 && editor !== this.GetSearchEditor()) 199 return; 200 this.activeElement = this.GetFilterEditorInputElement(editor); 201 }, 202 GetFilterEditorInputElement: function(editor) { 203 if(document.activeElement && !ASPx.Browser.VirtualKeyboardSupported) 204 return document.activeElement; 205 if(editor.GetInputElement) 206 return editor.GetInputElement(); 207 return null; 208 }, 209 GetHeaderFilterPopup: function() { return this.grid.GetHeaderFilterPopup(); }, 210 GetEnableCallbackAnimation: function() { return this.grid.enableCallbackAnimation; }, 211 GetEnableHeaderFilterCaching: function() { return this.grid.enableHeaderFilterCaching; }, 212 GetHeaderFilterIconClassName: function() { return this.grid.HeaderFilterButtonClassName; }, 213 GetColumnHeaders: function(columnIndex) { return [ this.grid.GetHeader(columnIndex, false), this.grid.GetHeader(columnIndex, true) ]; }, 214 GetColumn: function(columnIndex) { return this.grid._getColumn(columnIndex); }, 215 GetColumnCount: function() { return this.grid.GetColumnsCount(); }, 216 ApplyHeaderFilter: function() { this.grid.ApplyHeaderFilterByColumn(); }, 217 GetCustomizationWindow: function() { return this.grid.GetCustomizationWindow(); }, 218 ShowLoadingPanelInsideHeaderFilterPopup: function() { this.grid.ShowLoadingPanelInsideHeaderFilterPopup(); }, 219 GetListBox: function(columnIndex) { 220 var listBox = ASPx.GetControlCollection().Get(this.grid.name + "_HFListBox" + columnIndex); 221 return listBox && !listBox.IsDOMDisposed() ? listBox : null; 222 }, 223 GetSelectAllCheckBox: function(columnIndex) { 224 var checkBox = ASPx.GetControlCollection().Get(this.grid.name + "_HFSACheckBox" + columnIndex); 225 return checkBox && !checkBox.IsDOMDisposed() ? checkBox : null; 226 },
227 GetDateEdit_From: function(columnIndex) { 228 var dateEdit = ASPx.GetControlCollection().Get(this.grid.name + "_HFFDE" + columnIndex); 229 return dateEdit && !dateEdit.IsDOMDisposed() ? dateEdit : null; 230 }, 231 GetDateEdit_To: function(columnIndex) { 232 var dateEdit = ASPx.GetControlCollection().Get(this.grid.name + "_HFTDE" + columnIndex); 233 return dateEdit && !dateEdit.IsDOMDisposed() ? dateEdit : null; 234 }, 235 GetCalendar: function(columnIndex){ 236 var calendar = ASPx.GetControlCollection().Get(this.grid.name + "_HFC" + columnIndex); 237 return calendar && !calendar.IsDOMDisposed() ? calendar: null; 238 }, 239 GetSpinEdit_From: function(columnIndex) { 240 var spinEdit = ASPx.GetControlCollection().Get(this.grid.name + "_HFFSE" + columnIndex); 241 return spinEdit && !spinEdit.IsDOMDisposed() ? spinEdit : null; 242 }, 243 GetSpinEdit_To: function(columnIndex) { 244 var spinEdit = ASPx.GetControlCollection().Get(this.grid.name + "_HFTSE" + columnIndex); 245 return spinEdit && !spinEdit.IsDOMDisposed() ? spinEdit : null; 246 }, 247 GetRangeTrackBar: function(columnIndex) { 248 var rangeTrackBar = ASPx.GetControlCollection().Get(this.grid.name + "_HFTB" + columnIndex); 249 return rangeTrackBar && !rangeTrackBar.IsDOMDisposed() ? rangeTrackBar : null; 250 }, 251 GetHeaderFilterPopupRelatedColumn: function() { return this.headerFilterPopupRelatedColumn; }, 252 GetHeaderFilterButton: function(isCancelButton) { 253 var popup = this.GetHeaderFilterPopup(); 254 if(popup) 255 return ASPx.GetControlCollection().Get(isCancelButton ? popup.cpCancelButtonID : popup.cpOkButtonID); 256 return null; 257 }, 258 SendHeaderFilterCallback: function(columnIndex, shiftKey) { 259 this.grid.gridFuncCallBack([ ASPxClientGridViewCallbackCommand.FilterPopup, this.grid.name, columnIndex, shiftKey ? "T" : ""], this.OnHeaderFilterCallback); 260 }, 261 OnHeaderFilterCallback: function(values) { 262 var grid = ASPx.GetControlCollection().Get(values[0]); 263 if(grid) 264 grid.GetFilterHelper().ProcessHeaderFilterCallback(values[1], values[2]); 265 }, 266 GetHeaderFilterState: function(columnIndex) { 267 var listBoxSelectedIndices = [ ]; 268 var pickerRange = null; 269 var calendarDates = null; 270 var listBox = this.GetListBox(columnIndex); 271 if(listBox) 272 listBoxSelectedIndices = listBox.GetSelectedIndices(); 273 var column = this.GetColumn(columnIndex); 274 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangePicker) { 275 var dateEditFrom = this.GetDateEdit_From(columnIndex); 276 var dateEditTo = this.GetDateEdit_To(columnIndex); 277 if(dateEditFrom && dateEditTo) 278 pickerRange = { start: dateEditFrom.GetValue(), end: dateEditTo.GetValue() }; 279 } 280 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangeCalendar) { 281 var calendar = this.GetCalendar(columnIndex); 282 if(calendar) 283 calendarDates = calendar.GetSelectedDates(); 284 } 285 if(column.HFMode === ASPx.GridHeaderFilterMode.NumericRangePicker) { 286 var rangeTrackBar = this.GetRangeTrackBar(columnIndex); 287 if(rangeTrackBar) 288 pickerRange = { start: rangeTrackBar.GetPositionStart(), end: rangeTrackBar.GetPositionEnd() }; 289 var spinEdit_From = this.GetSpinEdit_From(columnIndex); 290 if(spinEdit_From) { 291 if(pickerRange) pickerRange.start = spinEdit_From.GetValue(); 292 else pickerRange = { start: spinEdit_From.GetValue() }; 293 } 294 var spinEdit_To = this.GetSpinEdit_To(columnIndex); 295 if(spinEdit_To) { 296 if(pickerRange) pickerRange.end = spinEdit_To.GetValue(); 297 else pickerRange = { end: spinEdit_To.GetValue() }; 298 } 299 } 300 return { listBoxSelectedIndices: listBoxSelectedIndices, pickerRange: pickerRange, calendarDates: calendarDates }; 301 }, 302 IsHeaderFilterChanged: function(columnIndex) { 303 var initialState = this.initialHeaderFilterState[columnIndex]; 304 var currentState = this.GetHeaderFilterState(columnIndex); 305 if(!initialState || !currentState) 306 return false; 307 if(!ASPx.Data.ArrayEqual(initialState.listBoxSelectedIndices, currentState.listBoxSelectedIndices)) 308 return true; 309 var column = this.GetColumn(columnIndex); 310 if((column.HFMode === ASPx.GridHeaderFilterMode.DateRangePicker || column.HFMode === ASPx.GridHeaderFilterMode.NumericRangePicker) && currentState.pickerRange) 311 return initialState.pickerRange.start !== currentState.pickerRange.start || initialState.pickerRange.end !== currentState.pickerRange.end; 312 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangeCalendar && currentState.calendarDates) 313 return !ASPx.Data.ArrayEqual(initialState.calendarDates, currentState.calendarDates); 314 return false; 315 }, 316 GetHeaderFilterCallbackState: function(columnIndex) { 317 var result = [ ]; 318 var listBox = this.GetListBox(columnIndex); 319 if(listBox) 320 result = result.concat(listBox.GetSelectedValues()); 321 var currentState = this.GetHeaderFilterState(columnIndex); 322 if(currentState.calendarDates && currentState.calendarDates.length > 0) 323 result.push("(Calendar)|" + this.CalcDateRanges(currentState.calendarDates, false).join("|")); 324 if(currentState.pickerRange && (ASPx.IsExists(currentState.pickerRange.start) || ASPx.IsExists(currentState.pickerRange.end))) { 325 var column = this.GetColumn(columnIndex); 326 var pickerType; 327 var range; 328 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangePicker) { 329 pickerType = "(DateRangePicker)"; 330 range = [ 331 currentState.pickerRange.start && ASPx.DateUtils.GetInvariantDateString(currentState.pickerRange.start) || "", 332 currentState.pickerRange.end && ASPx.DateUtils.GetInvariantDateString(currentState.pickerRange.end) || "" 333 ]; 334 } 335 if(column.HFMode === ASPx.GridHeaderFilterMode.NumericRangePicker) { 336 pickerType = "(NumericRangePicker)"; 337 var start = ASPx.IsExists(currentState.pickerRange.start) ? parseFloat(currentState.pickerRange.start) : NaN; 338 var end = ASPx.IsExists(currentState.pickerRange.end) ? parseFloat(currentState.pickerRange.end) : NaN; 339 range = [ 340 !isNaN(start) ? start : "",
341 !isNaN(end) ? end : "", 342 ]; 343 } 344 result.push(pickerType + "|" + range.join("|")); 345 } 346 return result; 347 }, 348 ProcessHeaderFilterCallback: function(columnIndex, htmlObj) { 349 this.headerFilterColumnIndicesToInitialize.push(parseInt(columnIndex)); 350 this.SetHeaderFilterPopupHtml(htmlObj, columnIndex); 351 }, 352 SetHeaderFilterPopupHtml: function(htmlObj, columnIndex) { 353 this.GetHeaderFilterPopup().SetContentHtml(htmlObj, this.GetEnableCallbackAnimation()); 354 }, 355 OnControlsInitialized: function() { 356 for(var i = 0; i < this.headerFilterColumnIndicesToInitialize.length; i++) 357 this.InitHeaderFilter(this.headerFilterColumnIndicesToInitialize[i]); 358 this.headerFilterColumnIndicesToInitialize = [ ]; 359 }, 360 InitHeaderFilter: function(columnIndex) { 361 this.initialHeaderFilterState[columnIndex] = this.GetHeaderFilterState(columnIndex); 362 var column = this.GetColumn(columnIndex); 363 this.headerFilterPopupRelatedColumn = column; 364 this.InitializeListBox(column); 365 if(column.HFMode === ASPx.GridHeaderFilterMode.CheckedList) 366 this.InitializeSelectAllCheckBox(column); 367 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangePicker) 368 this.InitializeDateRangePicker(column); 369 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangeCalendar) 370 this.InitializeCalendar(column); 371 if(column.HFMode === ASPx.GridHeaderFilterMode.NumericRangePicker) 372 this.InitializeNumericRangeEditors(column); 373 if(this.GetEnableAccessibility()) 374 this.InitializeAccessibility(column); 375 }, 376 InitializeListBox: function(column) { 377 var listBox = this.GetListBox(column.index); 378 if(!listBox) return; 379 if(column.HFMode === ASPx.GridHeaderFilterMode.List && this.GetEnableAccessibility()) 380 listBox.ItemClick.AddHandler(this.OnListBoxSelectionChanged.bind(this)); 381 else { 382 listBox.SelectedIndexChanged.AddHandler(this.OnListBoxSelectionChanged.bind(this)); 383 listBox.KeyDown.AddHandler(this.ProcessHeaderFilterKeyDown.bind(this)); 384 } 385 var element = listBox.GetListTable ? listBox.GetListTable() : listBox.GetMainElement(); 386 ASPx.Evt.AttachEventToElement(element, "mousedown", function() { window.setTimeout(ASPx.Selection.Clear, 0); }); 387 listBox.gvColumn = column; 388 if(listBox.cpFSI && listBox.cpFSI.length > 0) 389 this.PrepareSeparators(listBox); 390 if(this.IsListBoxHasScrolling()) 391 this.AdjustHeaderFilterListBox(column); 392 }, 393 ProcessHeaderFilterKeyDown: function(listbox, args) { 394 this.LockHeaderFilterApply(); 395 var evt = args.htmlEvent; 396 if(evt.keyCode == ASPx.Key.Enter) { 397 this.UnlockHeaderFilterApply(); 398 this.OnListBoxSelectionChanged(listbox); 399 } 400 window.setTimeout(this.UnlockHeaderFilterApply.bind(this), 100); 401 }, 402 LockHeaderFilterApply: function() { 403 this.lockHeaderFilterApply = true; 404 }, 405 UnlockHeaderFilterApply: function() { 406 this.lockHeaderFilterApply = false; 407 }, 408 IsHeaderFilterApplyLocked: function() { 409 return !!this.lockHeaderFilterApply; 410 }, 411 AdjustHeaderFilterListBox: function(column) { 412 var listBox = this.GetListBox(column.index); 413 if(listBox && listBox.GetMainElement() && this.RequireShowHeaderFilterListBoxScrollbar(column)) { 414 ASPx.SetStyles(listBox.GetMainElement(), { minHeight: this.GetHeaderFilterPopupScrollableElement().offsetHeight }); 415 listBox.AdjustControl(); 416 } 417 }, 418 InitializeSelectAllCheckBox: function(column) { 419 var checkBox = this.GetSelectAllCheckBox(column.index); 420 if(!checkBox) return; 421 checkBox.CheckedChanged.AddHandler(function(s) { this.OnSelectAllCheckedChanged(s); }.bind(this)); 422 checkBox.gvColumn = column; 423 }, 424 InitializeDateRangePicker: function(column) { 425 var dateEdit_From = this.GetDateEdit_From(column.index); 426 var dateEdit_To = this.GetDateEdit_To(column.index); 427 if(!dateEdit_From || !dateEdit_To) 428 return; 429 dateEdit_From.gvColumn = dateEdit_To.gvColumn = column; 430 dateEdit_From.ValueChanged.AddHandler(this.OnEditChanged.bind(this)); 431 dateEdit_To.ValueChanged.AddHandler(this.OnEditChanged.bind(this)); 432 this.AdjustRangePicker(dateEdit_From, dateEdit_To); 433 }, 434 InitializeNumericRangeEditors: function(column) { 435 var spinEdit_From = this.GetSpinEdit_From(column.index); 436 var spinEdit_To = this.GetSpinEdit_To(column.index); 437 var rangeTrackBar = this.GetRangeTrackBar(column.index); 438 if(spinEdit_From) { 439 spinEdit_From.gvColumn = column; 440 spinEdit_From.ValueChanged.AddHandler(function (s, e) { 441 if(rangeTrackBar) rangeTrackBar.SetPositionStart(s.GetValue()); 442 this.OnEditChanged(s); 443 }.bind(this)); 444 } 445 if(spinEdit_To) { 446 spinEdit_To.gvColumn = column; 447 spinEdit_To.ValueChanged.AddHandler(function (s, e) { 448 if(rangeTrackBar) rangeTrackBar.SetPositionEnd(s.GetValue()); 449 this.OnEditChanged(s); 450 }.bind(this)); 451 } 452 if(rangeTrackBar) { 453 rangeTrackBar.gvColumn = column; 454 rangeTrackBar.ValueChanged.AddHandler(function (s, e) {
455 if(spinEdit_From) spinEdit_From.SetValue(s.GetPositionStart()); 456 if(spinEdit_To) spinEdit_To.SetValue(s.GetPositionEnd()); 457 this.OnEditChanged(s); 458 }.bind(this)); 459 } 460 if(!spinEdit_From || !spinEdit_To) 461 return; 462 this.AdjustRangePicker(spinEdit_From, spinEdit_To); 463 }, 464 AdjustRangePicker: function(editor_From, editor_To) { 465 var firstCaptionCell = editor_From.GetCaptionCell(); 466 var secondCaptionCell = editor_To.GetCaptionCell(); 467 var width = Math.max(ASPx.GetClearClientWidth(firstCaptionCell), ASPx.GetClearClientWidth(secondCaptionCell)); 468 ASPx.SetStyles(firstCaptionCell, { minWidth: width }); 469 ASPx.SetStyles(secondCaptionCell, { minWidth: width }); 470 }, 471 InitializeCalendar: function(column) { 472 var calendar = this.GetCalendar(column.index); 473 calendar.SelectionChanged.AddHandler(this.OnEditChanged.bind(this)); 474 calendar.gvColumn = column; 475 }, 476 OnListBoxSelectionChanged: function(listBox) { 477 if(!listBox) return; 478 var column = listBox.gvColumn; 479 if(this.RequireApplyHeaderFilterNow(column.HFMode, column.index)) 480 this.ApplyHeaderFilter(); 481 else { 482 if(column.HFMode === ASPx.GridHeaderFilterMode.CheckedList) 483 this.UpdateSelectAllCheckState(column.index); 484 this.UpdateOkButtonEnabledState(column.index); 485 } 486 }, 487 OnSelectAllCheckedChanged: function(checkBox) { 488 var columnIndex = checkBox.gvColumn.index; 489 var listBox = this.GetListBox(columnIndex); 490 if(checkBox.GetChecked()) 491 listBox.SelectAll(); 492 else 493 listBox.UnselectAll(); 494 this.UpdateOkButtonEnabledState(columnIndex); 495 }, 496 OnEditChanged: function(editor) { 497 this.UpdateOkButtonEnabledState(editor.gvColumn.index); 498 }, 499 RequireApplyHeaderFilterNow: function(mode, columnIndex) { 500 return mode === ASPx.GridHeaderFilterMode.List && this.IsHeaderFilterChanged(columnIndex) && !this.IsHeaderFilterApplyLocked(); 501 }, 502 UpdateSelectAllCheckState: function(columnIndex) { 503 var checkBox = this.GetSelectAllCheckBox(columnIndex); 504 var listBox = this.GetListBox(columnIndex); 505 if(!checkBox || !listBox) 506 return; 507 var selectedItemCount = listBox.GetSelectedIndices().length; 508 var checkState = ASPx.CheckBoxCheckState.Indeterminate; 509 if(selectedItemCount === 0) 510 checkState = ASPx.CheckBoxCheckState.Unchecked; 511 else if(selectedItemCount === listBox.GetItemCount()) 512 checkState = ASPx.CheckBoxCheckState.Checked; 513 checkBox.SetCheckState(checkState); 514 }, 515 UpdateOkButtonEnabledState: function(columnIndex) { 516 if(this.GetColumn(columnIndex).HFMode !== ASPx.GridHeaderFilterMode.List) 517 this.SetHFOkButtonEnabled(this.IsHeaderFilterChanged(columnIndex)); 518 }, 519 ApplyHeaderFilterInitialState: function(columnIndex) { 520 var state = this.initialHeaderFilterState[columnIndex]; 521 if(!state) return; 522 var column = this.GetColumn(columnIndex); 523 var listBox = this.GetListBox(columnIndex); 524 if(listBox) { 525 if(column.HFMode === ASPx.GridHeaderFilterMode.List) { 526 if(this.GetEnableAccessibility() && state.listBoxSelectedIndices.length > 0) 527 listBox.SelectIndex(state.listBoxSelectedIndices[0]); 528 } else { 529 listBox.UnselectAll(); 530 listBox.SelectIndices(state.listBoxSelectedIndices); 531 } 532 } 533 if(column.HFMode === ASPx.GridHeaderFilterMode.CheckedList) 534 this.UpdateSelectAllCheckState(columnIndex); 535 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangePicker) { 536 this.GetDateEdit_From(columnIndex).SetValue(state.pickerRange.start); 537 this.GetDateEdit_To(columnIndex).SetValue(state.pickerRange.end); 538 } 539 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangeCalendar) { 540 var calendar = this.GetCalendar(columnIndex); 541 calendar.SetValue(null); 542 var dates = state.calendarDates || [ ]; 543 for(var i = 0; i < dates.length; i++) 544 calendar.SelectDate(dates[i]); 545 } 546 if(column.HFMode === ASPx.GridHeaderFilterMode.NumericRangePicker) { 547 var rangeTrackBar = this.GetRangeTrackBar(columnIndex); 548 if(rangeTrackBar) { 549 rangeTrackBar.SetPositionStart(state.pickerRange.start); 550 rangeTrackBar.SetPositionEnd(state.pickerRange.end); 551 } 552 var spinEdit_From = this.GetSpinEdit_From(columnIndex); 553 if(spinEdit_From) 554 spinEdit_From.SetValue(state.pickerRange.start); 555 var spinEdit_To = this.GetSpinEdit_To(columnIndex); 556 if(spinEdit_To) 557 spinEdit_To.SetValue(state.pickerRange.end); 558 } 559 this.SetHFOkButtonEnabled(false); 560 }, 561 IsListBoxHasScrolling: function() { return true; }, 562 RequireShowHeaderFilterListBoxScrollbar: function(column) { return this.IsListBoxHasScrolling() && column && (column.HFMode === ASPx.GridHeaderFilterMode.List || column.HFMode === ASPx.GridHeaderFilterMode.CheckedList); }, 563 GetHeaderFilterPopupScrollableElement: function() { return this.GetHeaderFilterPopup().GetWindowContentElement(-1); }, 564 InitializeHeaderFilterPopup: function() { 565 var popup = this.GetHeaderFilterPopup(); 566 if(!popup || !popup.GetWindowElement(-1)) 567 return; 568 this.initialHeaderFilterPopupMinWidth = popup.GetWindowMinWidth(); 569 popup.PopUp.AddHandler(this.HeaderFilterPopup_PopUpHandler); 570 popup.CloseUp.AddHandler(this.HeaderFilterPopup_CloseUpHandler); 571 popup.Resize.AddHandler(this.HeaderFilterPopup_ResizeHandler); 572 if(this.IsListBoxHasScrolling()) { 573 popup.AfterResizing.AddHandler(this.OnHeaderFilter_AfterResizing.bind(this)); 574 ASPx.Evt.AttachEventToElement(this.GetHeaderFilterPopupScrollableElement(), "scroll", this.OnHeaderFilterPopup_Scroll.bind(this)); 575 } 576 this.InitializeHeaderFilterButtons(); 577 }, 578 OnHeaderFilterPopup_PopUp: function(popup) { 579 var columnIndex = this.FindColumnIndexByHeaderChild(popup.GetCurrentPopupElement()); 580 var column = this.GetColumn(columnIndex); 581 if(!column) return;
582 var shiftKey = popup.GetPopUpReasonMouseEvent().shiftKey; 583 var callbackWaiting = this.LoadHeaderFilterPopupData(popup, column, shiftKey); 584 if(callbackWaiting) { 585 var size = this.GetHeaderFilterPopupSize(columnIndex); 586 this.SetHFButtonPanelVisibility(popup, this.RequireButtonPanel(column)); 587 this.AssignHeaderFilterPopupMinWidth(column); 588 if(size) { 589 popup.SetSize(size[0], size[1]); 590 if(ASPx.Browser.Firefox) 591 popup.Shown.AddHandler(function(s) { window.setTimeout(function() { s.SetSize(size[0], size[1]); }, 0); }); 592 } 593 this.ShowLoadingPanelInsideHeaderFilterPopup(); 594 } 595 if(this.IsListBoxHasScrolling()) 596 window.setTimeout(this.UpdateHeaderFilterPopupScroll.bind(this), popup.fadeAnimationDuration); 597 }, 598 LoadHeaderFilterPopupData: function(popup, column, shiftKey) { 599 if(column === this.GetHeaderFilterPopupRelatedColumn() && this.UseHeaderFilterContentCaching(column.index) && popup.savedShiftKey === shiftKey) { 600 this.ApplyHeaderFilterInitialState(column.index); 601 } else { 602 this.SendHeaderFilterCallback(column.index, shiftKey); 603 popup.SetContentHtml(""); 604 this.headerFilterPopupRelatedColumn = null; 605 popup.savedShiftKey = shiftKey; 606 return true; 607 } 608 }, 609 UpdateHeaderFilterPopupScroll: function() { 610 var column = this.GetHeaderFilterPopupRelatedColumn(); 611 var disablePopupScroll = this.RequireShowHeaderFilterListBoxScrollbar(column) && this.GetHeaderFilterPopup().IsVisible(); 612 ASPx.SetStyles(this.GetHeaderFilterPopupScrollableElement(), { overflowY: disablePopupScroll ? "hidden" : "auto" }); 613 }, 614 OnHeaderFilterPopup_CloseUp: function(popup) { 615 var column = this.GetHeaderFilterPopupRelatedColumn(); 616 if(column && !this.UseHeaderFilterContentCaching(column.index)) 617 window.setTimeout(function() { popup.SetContentHtml(""); }, 0); 618 this.UpdateHeaderFilterPopupScroll(); 619 }, 620 OnHeaderFilterPopup_Resize: function(popup) { 621 var columnIndex = this.FindColumnIndexByHeaderChild(popup.GetCurrentPopupElement()); 622 if(this.GetColumn(columnIndex)) 623 this.SetHeaderFilterPopupSize(columnIndex, popup.GetWidth(), popup.GetHeight()); 624 }, 625 OnHeaderFilter_AfterResizing: function(popup) { 626 var column = this.GetHeaderFilterPopupRelatedColumn(); 627 if(column) { 628 this.AdjustHeaderFilterListBox(column); 629 var rangeTrackBar = this.GetRangeTrackBar(column.index); 630 if(rangeTrackBar) 631 rangeTrackBar.AdjustControl(); 632 } 633 }, 634 OnHeaderFilterPopup_Scroll: function(e) { 635 var column = this.GetHeaderFilterPopupRelatedColumn(); 636 if(this.RequireShowHeaderFilterListBoxScrollbar(column)) 637 this.GetHeaderFilterPopupScrollableElement().scrollTop = 0; 638 }, 639 InitializeHeaderFilterButtons: function() { 640 var popup = this.GetHeaderFilterPopup(); 641 if(!popup) return; 642 var buttons = this.GetHeaderFilterButtons(); 643 for(var i = 0; i < buttons.length; i++) { 644 popup.AddPopupElement(buttons[i]); 645 if(this.GetEnableAccessibility()) 646 ASPx.Evt.AttachEventToElement(buttons[i], "keydown", GridFilterHelper.HeaderFilterButtonKeyDownHandler); 647 } 648 }, 649 UnloadHeaderFilterPopup: function() { 650 var popup = this.GetHeaderFilterPopup(); 651 if(!popup) return; 652 popup.PopUp.RemoveHandler(this.HeaderFilterPopup_PopUpHandler); 653 popup.CloseUp.RemoveHandler(this.HeaderFilterPopup_CloseUpHandler); 654 popup.Resize.RemoveHandler(this.HeaderFilterPopup_ResizeHandler); 655 popup.RemoveAllPopupElements(); 656 popup.Hide(); 657 if(this.GetEnableAccessibility()) { 658 var buttons = this.GetHeaderFilterButtons(); 659 for(var i = 0; i < buttons.length; i++) 660 ASPx.Evt.DetachEventFromElement(buttons[i], "keydown", GridFilterHelper.HeaderFilterButtonKeyDownHandler); 661 } 662 }, 663 GetHeaderFilterButtons: function() { 664 var buttons = [ ]; 665 var visibleIndices = this.GetVisibleColumnIndices(); 666 for(var i = 0; i < visibleIndices.length; i++) { 667 var index = visibleIndices[i]; 668 var headers = this.GetColumnHeaders(index); 669 for(var j = 0; j < headers.length; j++) 670 this.PopulateHeaderFilterButtons(headers[j], buttons); 671 } 672 var custWindow = this.GetCustomizationWindow(); 673 if(custWindow) 674 this.PopulateHeaderFilterButtons(custWindow.GetWindowClientTable(-1), buttons); 675 return buttons; 676 }, 677 GetVisibleColumnIndices: function() { 678 var indices = [ ]; 679 for(var i = 0; i < this.GetColumnCount(); i++) { 680 if(this.GetColumn(i).visible) 681 indices.push(this.GetColumn(i).index); 682 } 683 return indices; 684 }, 685 PopulateHeaderFilterButtons: function(container, buttons) { 686 if(!container) return; 687 var images = container.getElementsByTagName("IMG"); 688 for(var i = 0; i < images.length; i++) { 689 var button = ASPx.getSpriteMainElement(images[i]); 690 if(ASPx.ElementContainsCssClass(button, this.GetHeaderFilterIconClassName())) 691 buttons.push(button); 692 } 693 }, 694 RequireButtonPanel: function(column) { 695 return column.HFMode !== ASPx.GridHeaderFilterMode.List; 696 }, 697 SetHFButtonPanelVisibility: function(popup, visible) { 698 var buttonPanel = this.GetHeaderFilterPopupButtonPanelElement(); 699 if(buttonPanel) { 700 ASPx.SetElementDisplay(buttonPanel, visible); 701 this.SetHFOkButtonEnabled(false); 702 var okButton = this.GetHeaderFilterButton(false); 703 var cancelButton = this.GetHeaderFilterButton(true); 704 if(okButton && cancelButton && okButton.GetWidth() != cancelButton.GetWidth()) 705 ASPx.MakeEqualControlsWidth(popup.cpOkButtonID, popup.cpCancelButtonID); 706 } 707 }, 708 SetHFOkButtonEnabled: function(enabled) { 709 var button = this.GetHeaderFilterButton(false); 710 if(button) 711 button.SetEnabled(enabled); 712 }, 713 GetHeaderFilterPopupSize: function(key) { 714 var size = this.headerFilterPopupDimensions[key]; 715 if(size) return size; 716 if(!this.headerFilterPopupDimensions["Default"]) { 717 var popup = this.GetHeaderFilterPopup(); 718 this.SetHeaderFilterPopupSize("Default", popup.GetWidth(), popup.GetHeight()); 719 } 720 return this.headerFilterPopupDimensions["Default"]; 721 }, 722 SetHeaderFilterPopupSize: function(key, width, height) { 723 this.headerFilterPopupDimensions[key] = [ width, height ]; 724 }, 725 AssignHeaderFilterPopupMinWidth: function(column) { 726 var popup = this.GetHeaderFilterPopup(); 727 popup.minWidth = this.GetHeaderFilterPopupMinWidth(column); 728 }, 729 GetHeaderFilterPopupMinWidth: function(column) { 730 if(this.RequireButtonPanel(column)) 731 return this.GetHeaderFilterPopupWithButtonPanelMinWidth(); 732 return this.initialHeaderFilterPopupMinWidth; 733 }, 734 GetHeaderFilterPopupWithButtonPanelMinWidth: function() { 735 if(!ASPx.IsExists(this.headerFilterPopupWithButtonPanelMinWidth)) 736 this.headerFilterPopupWithButtonPanelMinWidth = this.CalculateHeaderFilterPopupWithButtonPanelMinWidth(); 737 return this.headerFilterPopupWithButtonPanelMinWidth; 738 }, 739 CalculateHeaderFilterPopupWithButtonPanelMinWidth: function() { 740 var popup = this.GetHeaderFilterPopup(); 741 var minWidth = popup.GetWidth(); 742 var buttonPanel = this.GetHeaderFilterPopupButtonPanelElement(); 743 if(buttonPanel) { 744 var footerElement = buttonPanel.parentNode; 745 var excess = buttonPanel.offsetWidth - ASPx.GetClearClientWidth(footerElement); 746 minWidth += excess; 747 } 748 minWidth = Math.max(minWidth, this.initialHeaderFilterPopupMinWidth); 749 return minWidth; 750 }, 751 GetHeaderFilterPopupButtonPanelElement: function() { 752 var popup = this.GetHeaderFilterPopup(); 753 return document.getElementById(popup.cpButtonPanelID); 754 }, 755 FindColumnIndexByHeaderChild: function(element) { 756 if(!element) 757 return -1; 758 var level = 0; 759 while(level < 6) {
760 var index = this.ResolveColumnIndex(element.id); 761 if(index > -1) 762 return index; 763 element = element.parentNode; 764 level++; 765 } 766 return -1; 767 }, 768 UseHeaderFilterContentCaching: function(columnIndex) { 769 if(!this.GetEnableHeaderFilterCaching()) 770 return false; 771 var listBox = this.GetListBox(columnIndex); 772 return listBox && listBox.GetMainElement() && listBox.GetItemCount() < 1000; 773 }, 774 CalcDateRanges: function(dates) { 775 var result = [ ]; 776 dates.sort(function(a, b) { return a - b; }); 777 var range = { start: null, end: null }; 778 for(var i = 0; i < dates.length; i++) { 779 var date = dates[i]; 780 if(!range.start || !range.end) 781 range.start = range.end = date; 782 var isLastDate = dates.length === i + 1; 783 var nextDate = ASPxClientCalendar.AddDays(date, 1); 784 if(!isLastDate && ASPx.DateUtils.AreDatesEqualExact(nextDate, dates[i + 1])) { 785 range.end = nextDate; 786 } else { 787 result.push(ASPx.DateUtils.GetInvariantDateString(range.start)); 788 result.push(ASPx.DateUtils.GetInvariantDateString(range.end)); 789 range.start = range.end = null; 790 } 791 } 792 return result; 793 }, 794 InitializeAccessibility: function(column) { 795 var listBox = this.GetListBox(column.index); 796 if(listBox) { 797 listBox.SelectedIndexChanged.AddHandler(function() { this.MakeListBoxSelectedItemVisible(column); }.bind(this)); 798 this.MakeListBoxSelectedItemVisible(column); 799 } 800 var popup = this.GetHeaderFilterPopup(); 801 if(popup && !popup.gvAccessibilityEventsAssigned) { 802 popup.Shown.AddHandler(function() { this.MakeListBoxSelectedItemVisible(this.GetHeaderFilterPopupRelatedColumn()); }.bind(this)); 803 ASPx.Evt.AttachEventToElement(popup.GetCurrentWindowElement(), "keydown", this.ProcessAccessibleHeaderFilterPopupKeyDown.bind(this)); 804 popup.gvAccessibilityEventsAssigned = true; 805 } 806 }, 807 MakeListBoxSelectedItemVisible: function(column) { 808 if(!column || column.HFMode !== ASPx.GridHeaderFilterMode.List) 809 return; 810 var listBox = this.GetListBox(column.index); 811 var itemIndex = listBox.GetSelectedIndex(); 812 var div = this.GetHeaderFilterPopupScrollableElement(); 813 var item = listBox.GetItemElement(itemIndex); 814 if(!div || !item) 815 return; 816 var itemHeight = item.offsetHeight; 817 var divHeight = parseInt(ASPx.GetCurrentStyle(div).height); 818 var itemStart = item.offsetTop; 819 var itemEnd = itemStart + itemHeight; 820 var divStart = div.scrollTop; 821 var divEnd = divStart + divHeight; 822 var scrollTop = divStart; 823 var isItemAbove = itemStart < divStart; 824 var isItemBelow = itemEnd > divEnd; 825 if(isItemAbove) 826 scrollTop = itemStart; 827 else if(isItemBelow) 828 scrollTop = itemEnd - divHeight; 829 if(div.scrollTop !== scrollTop) 830 div.scrollTop = scrollTop; 831 }, 832 ProcessAccessibleHeaderFilterPopupKeyDown: function(e) { 833 var keyCode = ASPx.Evt.GetKeyCode(e); 834 if(keyCode !== ASPx.Key.Enter) 835 return; 836 var handled = true; 837 var column = this.GetHeaderFilterPopupRelatedColumn(); 838 if(column.HFMode === ASPx.GridHeaderFilterMode.List) { 839 this.OnListBoxSelectionChanged(this.GetListBox(column.index)); 840 } else { 841 var applyFilterOnEnter = this.IsHeaderFilterChanged(column.index) && !this.IsCancelButtonEventSource(e) && !this.IsDateEditorDroppedDown(column); 842 if(applyFilterOnEnter) 843 this.ApplyHeaderFilter(); 844 else 845 handled = false; 846 } 847 if(handled) 848 ASPx.Evt.PreventEventAndBubble(e); 849 }, 850 IsCancelButtonEventSource: function(evt) { 851 return ASPx.GetIsParent(this.GetHeaderFilterButton(true).GetMainElement(), ASPx.Evt.GetEventSource(evt)); 852 }, 853 IsDateEditorDroppedDown: function(column) { 854 if(column.HFMode === ASPx.GridHeaderFilterMode.DateRangePicker) 855 return this.GetDateEdit_From(column.index).droppedDown || this.GetDateEdit_To(column.index).droppedDown; 856 return false; 857 }, 858 PrepareSeparators: function(listBox) { 859 if(typeof(ASPxClientListBox) != "undefined" && listBox instanceof ASPxClientListBox) 860 GridHFListBoxWrapper.Initialize(listBox); 861 for(var i = 0; i < listBox.cpFSI.length; i++) { 862 var separatorIndex = listBox.cpFSI[i]; 863 var item = listBox.GetItemElement(separatorIndex); 864 if(ASPx.IsExists(item)) { 865 var tr = ASPx.GetParentByTagName(item, "TR");
866 this.AppendSeparatorRow(tr); 867 } 868 } 869 }, 870 AppendSeparatorRow: function(targetRow){ 871 var newTr = document.createElement("TR"); 872 ASPx.InsertElementAfter(newTr, targetRow); 873 var td = document.createElement("TD"); 874 var colSpan = this.GetColSpanSum(targetRow); 875 if(colSpan > 1) 876 td.colSpan = colSpan; 877 newTr.appendChild(td); 878 var separatorDiv = document.createElement("DIV"); 879 separatorDiv.className = this.GetFilterValuesSeparatorClassName(); 880 td.appendChild(separatorDiv); 881 }, 882 GetColSpanSum: function(tableRow){ 883 var colSpan = 0; 884 var cells = ASPx.GetChildNodesByTagName(tableRow, "TD"); 885 for(var i = 0; i < cells.length; i++) 886 colSpan += cells[i].colSpan; 887 return colSpan; 888 }, 889 GetFilterValuesSeparatorClassName: function() { return this.grid.GetCssClassNamePrefix() + "HFSD"; }, 890}); 891var GridHFListBoxWrapper = { 892 Initialize: function(listBox){ 893 listBox.GetItemRow = GridHFListBoxWrapper.GetItemRow; 894 listBox.GetItemCount = GridHFListBoxWrapper.GetItemCount; 895 listBox.OnItemClickCore = listBox.OnItemClick; 896 listBox.OnItemClick = GridHFListBoxWrapper.OnItemClick; 897 listBox.FindInternalCheckBoxIndexCore = listBox.FindInternalCheckBoxIndex; 898 listBox.FindInternalCheckBoxIndex = GridHFListBoxWrapper.FindInternalCheckBoxIndex; 899 }, 900 GetItemRow: function(index){ 901 var itemRows = GridHFListBoxWrapper.GetItemRows(this); 902 if(index >= 0) 903 return itemRows[index] || null; 904 return null; 905 }, 906 OnItemClick: function(index, evt){ 907 var correctIndex = GridHFListBoxWrapper.GetCorrectItemIndex(this, index); 908 this.OnItemClickCore(correctIndex, evt); 909 }, 910 FindInternalCheckBoxIndex: function(element){ 911 var index = this.FindInternalCheckBoxIndexCore(element); 912 return GridHFListBoxWrapper.GetCorrectItemIndex(this, index); 913 }, 914 GetItemCount: function(){ 915 return GridHFListBoxWrapper.GetItemRows(this).length; 916 }, 917 GetCorrectItemIndex: function(listBox, index){ 918 for(var i = 0; i < listBox.cpFSI.length; i++) { 919 if(listBox.cpFSI[i] < index) 920 index--; 921 } 922 return index; 923 }, 924 GetItemRows: function(listBox){ 925 var itemRows = []; 926 var listTable = listBox.GetListTable(); 927 var rows = listTable ? listTable.rows : null; 928 for(var i = 0; rows && i < rows.length; i++){ 929 if(ASPx.ElementContainsCssClass(rows[i], "dxeListBoxItemRow")) 930 itemRows.push(rows[i]); 931 } 932 return itemRows; 933 } 934}; 935GridFilterHelper.HeaderFilterButtonKeyDownHandler = function(evt) { ASPx.Evt.InvokeMouseClickByKeyDown(evt, ASPx.PopupElementMouseEvent); }; 936ASPx.GridHeaderFilterMode = GridHeaderFilterMode; 937ASPx.GridFilterHelper = GridFilterHelper; 938})(); 939
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.