View Full Version : s.replace is not a function

24 Apr 2012, 4:23 AM
Hi Experts,

i am fetching results from the database when i click enter key in the filter ( datefield ) in the gridpanel in the format ('d-M-y')

when i press enter key it is fetching all the results correctly. Even in the json response i can see all the results in the prescribed format...but it is showing error like
Error : s.replace is not a function
according to my understanding, in the below function

escapeRe : function(s) { return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");


s value is taken as Date {Mon Apr 23 2012 00:00:00 GMT+0530 (India Standard Time)} even when i had specified the date format for the column model as 'd-M-y'

Please help me.....i am unable to resolve this from the past two days...(:|(:|(:|

Thanks in Advance,

24 Apr 2012, 5:02 AM
You need to verify the object type/class of the s argument. A code sample showing the context in which you're using the escapeRe function would also be helpful.

It may be that s is null or not of the type you expect.

24 Apr 2012, 5:24 AM
Hi friend,
thanks for your quick reply..

escapeRe is the function in ext-all-debug.js
i am unable to interpret when this function would be called by the ext-js
As per my understanding, escapeRe evaluates / or - in 23/april/2012.
while displaying the results from the jsonstore in the grid it is showing this error

s.replace is not a function

you can see the function escapeRe in line 5784 of ext-all-debug.js...

Thanks Again and cheers...

24 Apr 2012, 9:11 AM
I think this may be a problem in the way your date format is configured.

Can you post a code sample which shows the complete configuration of your grid panel and data store/model?

25 Apr 2012, 10:11 PM
Hi friend,

Thanks for your replies and suggestions...
I could solve my problem myself...
The function was not at all going into the filter event which was throwing the error...the reason was i misplaced a closing brace...:D:D