How to use `headerFilter` with `editor:autolookup`?
I have table. One field is generic, but another is lookup.
I use some list to display readable values instead of raw numbers.
I try to write custom headerFilter
for such column, but it is not called at all.
Try to filter data in ID
column and Country
column at next JS Fiddle code:
var header_filter = function( headerValue, rowValue, rowData, filterParams ) {
alert( 'Called' );
headerValue = headerValue.replace( / /g, '.*' );
var re = new RegExp( headerValue, 'i' );
return rowValue.search( re ) >= 0;
}
//Build Tabulator
var table = new Tabulator("#example-table", {
height:"311px",
data: tabledata,
columns:[
{title:"ID", field:"id", width:40, headerFilter: true, headerFilterFunc: header_filter, },
{title:"Country", field:"country_id", width:130, editor:"autocomplete", editorParams:{values: country_list, showListOnEmpty: true, }, formatter: "lookup", formatterParams: country_list,
headerFilter: true, headerFilterFunc: header_filter,
},
],
});
What did I wrong? How to use custom header filter on lookup field?
tabulator
add a comment |
I have table. One field is generic, but another is lookup.
I use some list to display readable values instead of raw numbers.
I try to write custom headerFilter
for such column, but it is not called at all.
Try to filter data in ID
column and Country
column at next JS Fiddle code:
var header_filter = function( headerValue, rowValue, rowData, filterParams ) {
alert( 'Called' );
headerValue = headerValue.replace( / /g, '.*' );
var re = new RegExp( headerValue, 'i' );
return rowValue.search( re ) >= 0;
}
//Build Tabulator
var table = new Tabulator("#example-table", {
height:"311px",
data: tabledata,
columns:[
{title:"ID", field:"id", width:40, headerFilter: true, headerFilterFunc: header_filter, },
{title:"Country", field:"country_id", width:130, editor:"autocomplete", editorParams:{values: country_list, showListOnEmpty: true, }, formatter: "lookup", formatterParams: country_list,
headerFilter: true, headerFilterFunc: header_filter,
},
],
});
What did I wrong? How to use custom header filter on lookup field?
tabulator
add a comment |
I have table. One field is generic, but another is lookup.
I use some list to display readable values instead of raw numbers.
I try to write custom headerFilter
for such column, but it is not called at all.
Try to filter data in ID
column and Country
column at next JS Fiddle code:
var header_filter = function( headerValue, rowValue, rowData, filterParams ) {
alert( 'Called' );
headerValue = headerValue.replace( / /g, '.*' );
var re = new RegExp( headerValue, 'i' );
return rowValue.search( re ) >= 0;
}
//Build Tabulator
var table = new Tabulator("#example-table", {
height:"311px",
data: tabledata,
columns:[
{title:"ID", field:"id", width:40, headerFilter: true, headerFilterFunc: header_filter, },
{title:"Country", field:"country_id", width:130, editor:"autocomplete", editorParams:{values: country_list, showListOnEmpty: true, }, formatter: "lookup", formatterParams: country_list,
headerFilter: true, headerFilterFunc: header_filter,
},
],
});
What did I wrong? How to use custom header filter on lookup field?
tabulator
I have table. One field is generic, but another is lookup.
I use some list to display readable values instead of raw numbers.
I try to write custom headerFilter
for such column, but it is not called at all.
Try to filter data in ID
column and Country
column at next JS Fiddle code:
var header_filter = function( headerValue, rowValue, rowData, filterParams ) {
alert( 'Called' );
headerValue = headerValue.replace( / /g, '.*' );
var re = new RegExp( headerValue, 'i' );
return rowValue.search( re ) >= 0;
}
//Build Tabulator
var table = new Tabulator("#example-table", {
height:"311px",
data: tabledata,
columns:[
{title:"ID", field:"id", width:40, headerFilter: true, headerFilterFunc: header_filter, },
{title:"Country", field:"country_id", width:130, editor:"autocomplete", editorParams:{values: country_list, showListOnEmpty: true, }, formatter: "lookup", formatterParams: country_list,
headerFilter: true, headerFilterFunc: header_filter,
},
],
});
What did I wrong? How to use custom header filter on lookup field?
tabulator
tabulator
asked Jan 2 at 18:01
Eugen KonkovEugen Konkov
6,40434166
6,40434166
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can not. This is prohibited:
Look at source
if(!(column.definition.headerFilter === "autocomplete"
|| (column.definition.editor === "autocomplete"
&& column.definition.headerFilter === true))){
add a comment |
You can use am autocomplete in the header filter to filter data, you just cant live filter data (ie the filter changes as you type in the autocomplete) it is only filtered when a value is selected from the autocomplete list
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
I have updated JS Fiddle.headerFilterParams
has now effect =(
– Eugen Konkov
Jan 7 at 10:27
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011054%2fhow-to-use-headerfilter-with-editorautolookup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can not. This is prohibited:
Look at source
if(!(column.definition.headerFilter === "autocomplete"
|| (column.definition.editor === "autocomplete"
&& column.definition.headerFilter === true))){
add a comment |
You can not. This is prohibited:
Look at source
if(!(column.definition.headerFilter === "autocomplete"
|| (column.definition.editor === "autocomplete"
&& column.definition.headerFilter === true))){
add a comment |
You can not. This is prohibited:
Look at source
if(!(column.definition.headerFilter === "autocomplete"
|| (column.definition.editor === "autocomplete"
&& column.definition.headerFilter === true))){
You can not. This is prohibited:
Look at source
if(!(column.definition.headerFilter === "autocomplete"
|| (column.definition.editor === "autocomplete"
&& column.definition.headerFilter === true))){
answered Jan 4 at 15:40
Eugen KonkovEugen Konkov
6,40434166
6,40434166
add a comment |
add a comment |
You can use am autocomplete in the header filter to filter data, you just cant live filter data (ie the filter changes as you type in the autocomplete) it is only filtered when a value is selected from the autocomplete list
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
I have updated JS Fiddle.headerFilterParams
has now effect =(
– Eugen Konkov
Jan 7 at 10:27
add a comment |
You can use am autocomplete in the header filter to filter data, you just cant live filter data (ie the filter changes as you type in the autocomplete) it is only filtered when a value is selected from the autocomplete list
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
I have updated JS Fiddle.headerFilterParams
has now effect =(
– Eugen Konkov
Jan 7 at 10:27
add a comment |
You can use am autocomplete in the header filter to filter data, you just cant live filter data (ie the filter changes as you type in the autocomplete) it is only filtered when a value is selected from the autocomplete list
You can use am autocomplete in the header filter to filter data, you just cant live filter data (ie the filter changes as you type in the autocomplete) it is only filtered when a value is selected from the autocomplete list
answered Jan 5 at 16:05


Oli FolkerdOli Folkerd
1,78411117
1,78411117
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
I have updated JS Fiddle.headerFilterParams
has now effect =(
– Eugen Konkov
Jan 7 at 10:27
add a comment |
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
I have updated JS Fiddle.headerFilterParams
has now effect =(
– Eugen Konkov
Jan 7 at 10:27
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
autoselect list does not appear. I can not select anything. JS Fiddle
– Eugen Konkov
Jan 5 at 18:50
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
In your example you don't have any headerFilterParams set so it has no idea how to configure the autocomplete
– Oli Folkerd
Jan 6 at 0:01
I have updated JS Fiddle.
headerFilterParams
has now effect =(– Eugen Konkov
Jan 7 at 10:27
I have updated JS Fiddle.
headerFilterParams
has now effect =(– Eugen Konkov
Jan 7 at 10:27
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011054%2fhow-to-use-headerfilter-with-editorautolookup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown