0

In jqGrid when we click on Edit button then jqGrid loads data in the Edit Form with extra spaces at the end of the field. for example when i see the username then its looks like as under:

Username: farhan(space)(space)(space)(space)(space)

How do i remove extra space from it?

Usman
  • 3,200
  • 3
  • 28
  • 47
Siddiqui
  • 172
  • 1
  • 3
  • 16

1 Answers1

0

How you fill the grid? Come the data from the database where you use char instead of varchar SQL type? Is it not better to trim the texts already on the server side before placing it in the JSON response used to fill the grid? One more possibility to cut the spaces exist on the client side. You can use jsonmap to do this (see the answer for example)

If you really need to cut the spaces only in the form dialog you can use afterShowForm or beforeShowForm to modify the form contain. You can find the <input> element by id for example. The id will be the same as the name property from the corresponding column of the colModel. So you can get the current value, call $.trim and set the result as the new value of the <input> element.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798