kimchi-project / ginger

WoK plugin for host management
Other
66 stars 41 forks source link

Bootgrid filter break for filtering formated number for locale fr-FR #349

Closed archu-s closed 8 years ago

archu-s commented 8 years ago

When a number(in thousand) range are formatted as per locale fr-FR, it insert non-breaking space. e.g 1,233 in English is 1 233 in fr-FR(here the space is non-breaking space)

num=Number(1233).toLocaleString('fr-FR') num.charCodeAt(1) --> This gives 160

' '..charCodeAt(0) --> This gives 32

When we enter space using keyboard space, it inserts breaking space which looks similar to non-breaking space. Since in bootgrid JS the regexp will have breaking space( and not \s), hence will not able to find the number.

I can think of below two options:

  1. Either after formatting the number we should replace non-breaking space with ' '.
  2. fix in bootgrid.js to replace ' ' with \s in regular expression, which take care of non-breaking space also.
danielhb commented 8 years ago

This really looks like a Bootgrid issue which should be fixed globally in WoK using either (1) or (2).

On 05/25/2016 03:43 AM, Archana Singh wrote:

When a number(in thousand) range are formatted as per locale fr-FR, it insert non-breaking space. e.g 1,233 in English is 1 233 in fr-FR(here the space is non-breaking space)

num=Number(1233).toLocaleString('fr-FR') num.charCodeAt(1) --> This gives 160

' '..charCodeAt(0) --> This gives 32

When we enter space using keyboard space, it inserts breaking space which looks similar to non-breaking space. Since in bootgrid JS the regexp will have breaking space( and not \s), hence will not able to find the number.

I can think of below two options:

  1. Either after formatting the number we should replace non-breaking space with ' '.
  2. fix in bootgrid.js to replace ' ' with \s in regular expression, which take care of non-breaking space also.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/kimchi-project/ginger/issues/349

archu-s commented 8 years ago

For #1, for number formatter as per locale, the changes should go in wok.

Its good idea to have wok level number formatter used across plugin.