updated FML to improve Page chunking
This commit is contained in:
		| @@ -425,22 +425,23 @@ if (PageButtons.existskey(Event.Control.ControlId)) { | |||||||
| Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAction, Integer _MinPageNumber, Integer _MaxPageNumber, Text[Integer] _Pages, Text _PreviousChunkAction, Text _NextChunkAction, Boolean _ChunkActionAppendPageNumber) { | Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAction, Integer _MinPageNumber, Integer _MaxPageNumber, Text[Integer] _Pages, Text _PreviousChunkAction, Text _NextChunkAction, Boolean _ChunkActionAppendPageNumber) { | ||||||
| 	declare {$currentPageVariable} for This = Integer[Text]; | 	declare {$currentPageVariable} for This = Integer[Text]; | ||||||
| 	if (!{$currentPageVariable}.existskey(_PagingId)) return; | 	if (!{$currentPageVariable}.existskey(_PagingId)) return; | ||||||
| 	declare CurrentPage = {$currentPageVariable}[_PagingId] + _BrowseAction; | 	declare NewPageNumber = {$currentPageVariable}[_PagingId] + _BrowseAction; | ||||||
| 	if (CurrentPage < _MinPageNumber) { | 	if (NewPageNumber < _MinPageNumber) { | ||||||
| 		CurrentPage = _MinPageNumber; | 		NewPageNumber = _MinPageNumber; | ||||||
| 	} else if (CurrentPage > _MaxPageNumber) { | 	} else if (NewPageNumber > _MaxPageNumber) { | ||||||
| 		CurrentPage = _MaxPageNumber; | 		NewPageNumber = _MaxPageNumber; | ||||||
| 	} | 	} | ||||||
| 	{$currentPageVariable}[_PagingId] = CurrentPage; | 	{$currentPageVariable}[_PagingId] = NewPageNumber; | ||||||
| 	declare PageFound = False; | 	if (_Pages.existskey(NewPageNumber)) { | ||||||
|         foreach (PageNumber => PageId in _Pages) { |         foreach (PageNumber => PageId in _Pages) { | ||||||
|             declare PageControl <=> Page.GetFirstChild(PageId); |             declare PageControl <=> Page.GetFirstChild(PageId); | ||||||
| 		PageControl.Visible = (CurrentPage == PageNumber); |             PageControl.Visible = (PageNumber == NewPageNumber); | ||||||
| 		if (PageControl.Visible) { |  | ||||||
| 			PageFound = True; |  | ||||||
|         } |         } | ||||||
|  |         if (_PageLabelId != \"\") { | ||||||
|  |             declare PageLabel <=> (Page.GetFirstChild(_PageLabelId) as CMlLabel); | ||||||
|  |             PageLabel.Value = NewPageNumber^\"/\"^_MaxPageNumber; | ||||||
|         } |         } | ||||||
| 	if (!PageFound && _BrowseAction != 0) { | 	} else { | ||||||
| 		declare Text ChunkAction; | 		declare Text ChunkAction; | ||||||
| 		if (_BrowseAction < 0) { | 		if (_BrowseAction < 0) { | ||||||
| 			ChunkAction = _PreviousChunkAction; | 			ChunkAction = _PreviousChunkAction; | ||||||
| @@ -448,14 +449,10 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct | |||||||
| 			ChunkAction = _NextChunkAction; | 			ChunkAction = _NextChunkAction; | ||||||
| 		} | 		} | ||||||
| 		if (_ChunkActionAppendPageNumber) { | 		if (_ChunkActionAppendPageNumber) { | ||||||
| 			ChunkAction ^= CurrentPage; | 			ChunkAction ^= NewPageNumber; | ||||||
| 		} | 		} | ||||||
| 		TriggerPageAction(ChunkAction); | 		TriggerPageAction(ChunkAction); | ||||||
| 	} | 	} | ||||||
| 	if (_PageLabelId == " . Builder::EMPTY_STRING . ") return; |  | ||||||
| 	declare PageLabel <=> (Page.GetFirstChild(_PageLabelId) as CMlLabel); |  | ||||||
| 	if (PageLabel == Null) return; |  | ||||||
| 	PageLabel.Value = CurrentPage^\"/\"^_MaxPageNumber; |  | ||||||
| }"; | }"; | ||||||
| 		$script->addScriptFunction($updatePageFunction, $functionText); | 		$script->addScriptFunction($updatePageFunction, $functionText); | ||||||
| 		return $this; | 		return $this; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user