Skip to content

The fields "text" and "number" set default value in the filter when no value has been entered by the user #125

@StefH

Description

@StefH

For the jsgrid.field.text, when the user does not search for this column, the filter still contains the default value ("" = empty string).

My proposal is to modify the filterValue function into:

filterValue: function() {
  return this.filterControl.val() !== "" ? this.filterControl.val() : undefined;
}

When do value is entered, this will return undefined.

Same as in the CheckboxField code:

filterValue: function() {
    return this.filterControl.get(0).indeterminate ? undefined : this.filterControl.is(":checked");
},

Same for the jsgrid.field.number, the default value contains a integer 0 when the user does not search on this.

But if this change breaks the implementation, it's maybe better to add a property named filterValueHasValue like this:

filterValueHasValue: function() {
    return this.filterControl.val() !== "";
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions