Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DataTables "lengthChange" option #1106

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class DataTableCore extends UIData implements net.bootsfaces.ren
protected enum PropertyKeys {
ajax, autoUpdate, border, caption, colLg, colMd, colSm, colXs, columnVisibility, contentDisabled, copy, csv,
customLangUrl, customOptions, delay, deselectOnBackdropClick, disabled, display, excel, fixedHeader, hidden,
immediate, info, lang, largeScreen, markSearchResults, mediumScreen, multiColumnSearch,
immediate, info, lang, largeScreen, lengthChange, markSearchResults, mediumScreen, multiColumnSearch,
multiColumnSearchPosition, offset, offsetLg, offsetMd, offsetSm, offsetXs, onclick, oncomplete, ondblclick,
ondeselect, onerror, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onorder, onpage, onsearch,
onselect, onsuccess, pageLength, pageLengthMenu, paginated, pdf, print, process, responsive, rowGroup,
Expand Down Expand Up @@ -448,6 +448,22 @@ public void setLargeScreen(String _largeScreen) {
getStateHelper().put(PropertyKeys.largeScreen, _largeScreen);
}

/**
* Allows the user to disable the pageLength menu. Defaults to true. <P>
* @return Returns the value of the attribute, or , false, if it hasn't been set by the JSF file.
*/
public boolean isLengthChange() {
return (boolean) (Boolean) getStateHelper().eval(PropertyKeys.lengthChange, true);
}

/**
* Allows the user to disable the pageLength menu. Defaults to true. <P>
* Usually this method is called internally by the JSF engine.
*/
public void setLengthChange(boolean _lengthChange) {
getStateHelper().put(PropertyKeys.lengthChange, _lengthChange);
}

/**
* If true, search results are marked yellow as you type. Based on mark.js (see https://datatables.net/blog/2017-01-19). <P>
* @return Returns the value of the attribute, or , false, if it hasn't been set by the JSF file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce
}
options = addOptions("pageLength: " + pageLength, options);
options = addOptions("lengthMenu: " + getPageLengthMenu(dataTable), options);
options = addOptions("lengthChange: " + dataTable.isLengthChange(), options);
options = addOptions("searching: " + dataTable.isSearching(), options);
options = addOptions("order: " + orderString, options);
options = addOptions("stateSave: " + dataTable.isSaveState(), options);
Expand Down
12 changes: 12 additions & 0 deletions src/main/meta/META-INF/bootsfaces-b.taglib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6563,6 +6563,18 @@
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Activates the page length menu of the dataTable. Default value is 'true'.]]></description>
<name>length-change</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[Activates the page length menu of the dataTable. Default value is 'true'.]]></description>
<name>lengthChange</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[If true, search results are marked yellow as you type. Based on mark.js (see https://datatables.net/blog/2017-01-19).]]></description>
<name>mark-search-results</name>
Expand Down
1 change: 1 addition & 0 deletions xtext/BootsFaces.jsfdsl
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ widget dataTable
immediate Boolean "Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. Default is false."
info Boolean default "true" "If set, this will enable the information about record count. Defaults to true."
lang String "Configured lang for the dataTable. If no default language is configured, the language configured in the browser is used."
length-change Boolean default "true" "Activates the page length menu of the dataTable"
mark-search-results Boolean "If true, search results are marked yellow as you type. Based on mark.js (see https://datatables.net/blog/2017-01-19)."
multi-column-search Boolean "If true, &lt;b:inputText /&gt; fields will be generated at the bottom of each column which allow you to perform per-column filtering."
multi-column-search-position default "bottom" "Should the multi-column-search attributes be at the bottom or the top of the table? Legal values: 'top','botton', and 'both'. Default to 'bottom'."
Expand Down