Extjs datefield手动显示选择器

时间:2016-12-14 11:33:58

标签: extjs extjs5

我正在尝试在满足特定条件时手动显示日期字段选择器。

Ext.getCmp('datef').getPicker().show();

这很好用,但问题是选择器的对齐方式。它总是出现在浏览器窗口的中心,但我希望它出现在日期选择器下面。

这是一个小提琴https://fiddle.sencha.com/#view/editor&fiddle/1mh5

当我在代码中手动显示选择器时,如何确保选择器始终在日期字段下对齐?

1 个答案:

答案 0 :(得分:0)

我认为调用已具有对齐

的所有功能的展开更容易

PVOID pvNtMapViewOfSection; LONG NTAPI OnVex(::PEXCEPTION_POINTERS ExceptionInfo) { if (ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_SINGLE_STEP && ExceptionInfo->ExceptionRecord->ExceptionAddress == pvNtMapViewOfSection) { struct MapViewOfSection_stack { PVOID ReturnAddress; HANDLE SectionHandle; HANDLE ProcessHandle; PVOID *BaseAddress; ULONG_PTR ZeroBits; SIZE_T CommitSize; PLARGE_INTEGER SectionOffset; PSIZE_T ViewSize; SECTION_INHERIT InheritDisposition; ULONG AllocationType; ULONG Win32Protect; } * stack = (MapViewOfSection_stack*)(ULONG_PTR)ExceptionInfo->ContextRecord->Esp; if (stack->ProcessHandle == NtCurrentProcess()) { SECTION_BASIC_INFORMATION sbi; if (0 <= ZwQuerySection(stack->SectionHandle, SectionBasicInformation, &sbi, sizeof(sbi), 0)) { if (PVOID pv = VirtualAlloc(0, (SIZE_T)sbi.Size.QuadPart, MEM_RESERVE|MEM_TOP_DOWN, PAGE_NOACCESS)) { if (VirtualFree(pv, 0, MEM_RELEASE)) { *stack->BaseAddress = pv; } } } } // RESUME_FLAG ( 0x10000) not supported by xp, but anyway not exist 64bit xp ExceptionInfo->ContextRecord->EFlags |= RESUME_FLAG; return EXCEPTION_CONTINUE_EXECUTION; } return EXCEPTION_CONTINUE_SEARCH; } struct LOAD_DATA { PCWSTR lpLibFileName; HMODULE hmod; ULONG dwError; }; ULONG WINAPI HideFromDebuggerThread(LOAD_DATA* pld) { NtSetInformationThread(NtCurrentThread(), ThreadHideFromDebugger, 0, 0); ULONG dwError = 0; HMODULE hmod = 0; if (PVOID pv = AddVectoredExceptionHandler(TRUE, OnVex)) { ::CONTEXT ctx = {}; ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS; ctx.Dr7 = 0x404; ctx.Dr1 = (ULONG_PTR)pvNtMapViewOfSection; if (SetThreadContext(GetCurrentThread(), &ctx)) { if (hmod = LoadLibraryW(pld->lpLibFileName)) { pld->hmod = hmod; } else { dwError = GetLastError(); } ctx.Dr7 = 0x400; ctx.Dr1 = 0; SetThreadContext(GetCurrentThread(), &ctx); } else { dwError = GetLastError(); } RemoveVectoredExceptionHandler(pv); } else { dwError = GetLastError(); } pld->dwError = dwError; return dwError; } HMODULE LoadLibHigh(PCWSTR lpLibFileName) { BOOL bWow; HMODULE hmod = 0; if (IsWow64Process(GetCurrentProcess(), &bWow) && bWow) { if (pvNtMapViewOfSection = GetProcAddress(GetModuleHandle(L"ntdll"), "NtMapViewOfSection")) { LOAD_DATA ld = { lpLibFileName }; if (IsDebuggerPresent()) { if (HANDLE hThread = CreateThread(0, 0, (PTHREAD_START_ROUTINE)HideFromDebuggerThread, &ld, 0, 0)) { WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); } } else { HideFromDebuggerThread(&ld); } if (!(hmod = ld.hmod)) { SetLastError(ld.dwError); } } } else { hmod = LoadLibrary(lpLibFileName); } return hmod; }