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