This is a migrated thread and some comments may be shown as answers.

[Solved] NumericTextBox Clear Filter Problem

3 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Drew
Top achievements
Rank 1
Drew asked on 28 Jun 2010, 08:26 PM
Hello,

I recently upgraded my web app to the newest MVC controls and while going through the code adjustments, I came across this weird bug that im unsure on how to proceed.

I have 2 html links that trigger the filter dropdowns on 2 fields in my grid,  one which contains an int value for the column and one thats a string.

I have a jquery command that autocleared the input parameters on the filter when you select it so a previous search wont get in the way when clicking search by [field] again.  Here's the clear code that used to work

$(':input').val('');

As you see,  quite simple, BUT when using firebug to inspect the newly generated code, Im seeing references to numerictextbox, which is pretty obvious that if you try and add an empty string value to a text input field that only allows numeric entry, this command will be ignored.

Do you have or know an additional jquery command I can use to clear this text box value when my users click my "Search" link?

ALSO: This issue happens if you click the "Clear Filter" button thats part of the grid filter itself.
At first, this statement will look incorrect if you try and test it, but when you click the clear filter button, the numeric text field will go blank,  but when you click into the field and gain focus, BAM, the previous value automatically comes back.  the only way to clear it is if you actually backspace the data from the numeric text box.
(This only Happens on fields of an int type)

Im not sure if this is a known issue but please let me know if you can help.  
Worse case scenario, I know I can convert the int values to strings on the way out but I really like how the numeric text box restricts any non numeric values automatically.

Thanks in advance!

 

3 Answers, 1 is accepted

Sort by
0
Drew
Top achievements
Rank 1
answered on 28 Jun 2010, 09:54 PM
FIXED IT:

Calling

$(

 

'#FieldToFilter-input-text').select(); seems to clear the values in the filter. 

I have a followup question now.
How can I trigger the "Clear Filter" button on an individual dropdown filter from the grid.

When I click the filter button on the 2nd field I wish to search, the first filter is still being applied to the search when I no longer want it to.

I have to manually click Clear Filter on the first filter dropdown before moving on to the next field.

I tried something like:
$('.t-animation-container:eq(NUMBER OF FILTER DROPDOWN IM SELECING) .t-button .t-state-default .t-clear-button').trigger(); to no avail.

Any help on this would be greatly appreciated.

 

 

 

 

 

0
frederic rybkowski
Top achievements
Rank 1
answered on 09 Jul 2010, 12:13 PM
.
0
frederic rybkowski
Top achievements
Rank 1
answered on 09 Jul 2010, 02:25 PM
.
Tags
Grid
Asked by
Drew
Top achievements
Rank 1
Answers by
Drew
Top achievements
Rank 1
frederic rybkowski
Top achievements
Rank 1
Share this question
or