What is the best way to incorporate a N/A button into the dateRangeFilter located in the header of a webix dataTable, enabling the exclusion of N/A values within that specific column?

`webix.ready(function(){
    grid = webix.ui({
        container:"tracker",
        editaction:"click",
        editable:true,
        view:"datatable",
        css:"webix_header_border", 
        leftSplit:1,
        columns:[
            {% for column in program_fields %}
                { 
                    id:"{{ column }}", 
                    header:[
                        { text:"{{ column|external_name }}",  css:"multiline" }, 
                        {% if column in program_date_fields %}
                            { content:"dateRangeFilter" }
                        ],
                        sort:"date",
                        {% if column in editable_fields %}
                            editor:"date",  
                            fixed: true,
                        {% endif %}
                        template: function (obj, common) {
                            if (obj.{{ column }} === null || obj.{{ column }} === "") {
                                {% if column in program_na_fields %}
                                    return `<div class="date-cell" >
                                                ${webix.i18n.dateFormatStr(obj.{{ column }})}
                                                {% if column in editable_fields %} <span class="webix_icon wxi-pencil">-<input class='nabtn' type='button' value='N/A' na-date-column='{{ column }}' style='font-size: small;'></span>{% endif %}</div>`;
                                {% else %}
                                    {% if column in editable_fields %}
                                        return common.editIcon(obj, common);
                                    {% else %}
                                        return "";
                                    {% endif %}
                                {% endif %}
                            } else if (obj.{{ column }} < new Date(1901, 0, 1)) {
                                return "N/A";
                            } else {
                                return `<div class="date-cell">${webix.i18n.dateFormatStr(obj.{{ column }})}</div>`;
                            }
                        }
                    {% endif %}
                },
            {% endfor %}
        ],
        select:"row",
        scroll:"xy",
        hidden:false,
        resizeColumn:true,
        headermenu:true,
        data: data,
    });
});
`

I have integrated my datatable with the webix library to create a customized feature - an N/A button in each specific column's datarange filter. This button will help filter out all the N/A values within that particular column, eliminating the need to manually select Jan 1900 as the date range option. By implementing this button, users can easily toggle and filter out N/A values in their data table.

Answer №1

Consider modifying the header section

                    header:[
                    { text:"{{ column|external_name }}",  css:"multiline" }, 
                    {% if column in programme_date_fields %}
                        { content:"dateRangeFilter" },
                        { 
                            template: function(){ 
                                return "<button class='nabtn'>N/A</button>"; 
                            },
                            width: 50,
                            css: "webix_header_button",
                            click: function(){
                                var columnId = this.config.id;
                                grid.filter(function(obj){
                                    return obj[columnId] !== "N/A";
                                },{ column: columnId });
                            }
                        }
                    {% endif %}
                ],

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing window.location.pathname in Next.js for precise targeting

Are you familiar with targeting window.location.pathname in NEXT.JS? I encountered a red error while using this code in Next.js const path = window.location.pathname console.log(path) // I am able to retrieve the pathname here Then { ...

Do I have to cram all the content onto a single page just to use a scroll effect?

I'm currently facing a dilemma as I work on building my portfolio. My goal is to primarily use html5 and css3, along with a bit of js, jquery, and other tools if necessary. Although I am not an expert in web development, I wanted to push myself to cre ...

fresh map from Google: Coordinates LatLng may not be a number, but my hunch tells me it is

Seeking Assistance with this Issue - For example, the initial location data appears as: "Object Lat: -36.768498 Lng: 174.75895" However, an error is indicating that the latitude is not recognized as a number. Rather than making adjustments without clea ...

Possible revision: "Exploring ways to iterate through an array of objects in Node/Express and verify if a corresponding entry exists in a MongoDB

Working on building a web application using the MEAN stack and Yelp API to retrieve an array of objects representing local businesses. I manipulate this data on the front-end, but before sending a response, I need to verify if a specific object exists in m ...

Is it possible for Skycons to show a duplicate icon?

My current issue involves integrating the JavaScript plugin "Skycons" with the Yahoo weather RSS feed. The problem arises when multiple days have the same weather forecast, as the plugin retrieves icons based on ID rather than class. This prevents me from ...

Incorporate variable key-value pairs into a JavaScript array or object

Is it possible to add a key value pair to an existing JavaScript associative array using a variable as the key? I need this for JSON encoding and prefer a simple solution over using plugins or frameworks. ary.push({name: val}); In the above code snippet, ...

Vuetify: Utilizing condition-based breakpoints

Here is the layout that I am working with: https://i.stack.imgur.com/qlm60.png This is the code snippet that I have implemented: <template> <v-card> <v-card-text> <v-container grid-list-xl fluid class="py-0 m ...

method that provides route-specific variable outputs

I have a situation where multiple routes require the same userdata from the database. Although I have a function to verify if the user is logged in, this function does not return the user variables. Here is an example route: app.get('/template', ...

Surprising "unexpected end of line" JavaScript lint notification out of nowhere

In this simplified version of my JavaScript code: function addContent() { var content = []; content.append( makeVal({ value : 1 }) ); // lint message generated } After running a lint program, I received the followi ...

JavaScript Equivalent to C#'s BinaryReader.ReadString() Function

Currently, I am in the process of translating C# code into JavaScript. While transferring multiple datatypes from this file to matching functionalities found in various JavaScript libraries was relatively smooth, there is one specific function that seems t ...

"Encountered an undefined error with the title property of this.state.project in the Wordpress API

I'm currently working on a project that involves a Backend Wordpress and a front-end React setup. However, I've encountered an issue when attempting to retrieve the title.rendered from the JSON Data. This error is displayed: TypeError: this.sta ...

When setting up a new nodejs/express project, I encountered an issue where the fresh installation would fail

After setting up node and express on my new development server, I created a test application by running the command below: dev-server15:/var/www# express mytest create : mytest create : mytest/package.json create : mytest/app.js ... The npm ...

The inconsistency between updating data in the model and its corresponding binding in the controller

I've been attempting to implement this specific approach in my application, but I'm encountering difficulties. CountriesModel.js app.service('CountriesModel', ['$http', function($http) { $http.get(baseUrl + 'api/co ...

Ensure that the v-for attribute has an increased value

Is there a way to have an incremented value in this code snippet? :data-value="Math.round(elecs[index].obtenus/elecs[index].maxsiege*100) Here is my attempt at iteration : :data-value="Math.round(result += elecs[index].obtenus/elecs[index].maxsiege*100 ...

alert message specific to a certain page (triggered by clicking the back button, accessing the menu, or pressing a particular button

I am facing a dilemma with a web application that allows the administrator (my client) to edit orders. They have expressed a need for warnings to prevent the loss of work. These warnings should trigger if you click on: Buttons such as Save, Work Order, D ...

It seems that although both axios.put methods are identical, only one is functioning properly

Could someone clarify the distinction between these two syntaxes and why the first one is not functioning correctly? Attempting to use the first code block results in a 401 error: const handleSubmit = () => { axios.put(`url`, { headers: { Aut ...

Fixing the 'window is not defined' Error in Node JS through Command Line

Trying to incorporate Angular JS using 'require' in my code snippet: var ang = require('angular'); However, encountering an error: ReferenceError: window is not defined I am aware that the window object is not defined in the Node co ...

Issue: Unable to access GET request with Express and handlebars

Hello everyone, I'm just getting started with JS/Handlebars and I'm facing an issue trying to display an image from my home.hbs file in VS Code. When I start the server, this is the message I receive: https://i.sstatic.net/wUxB7.jpg Below is th ...

Having trouble adding a property to an object, any solutions?

I've been struggling with adding a property to a nested Object in my JavaScript code. Despite setting the property name and value, the property doesn't seem to persist. populated_post.comments[i].comment.end = true console.log(typeof(populated_po ...

Angular 4's Mddialog experiencing intermittent display problem

While using MDDialog in my Angular app, I've encountered a couple of issues. Whenever a user clicks on the div, flickering occurs. Additionally, if the user then clicks on one of the buttons, the afterclose event is not triggered. Can anyone provide ...