3

I am developing an site for college. In that i am displaying Staff Details in jqGrid along with Employee Name, Address, Mobile Number and Departments. The grid looks like the below Before Updating and the DB looks like below Before Adding(DB) when i alter any of the columns the Address column gets wider both in database and on grid.After Adding and DB looks like this After Adding(DB) Any reason why this is happening .

Roman C
  • 49,761
  • 33
  • 66
  • 176
Rithesh
  • 135
  • 1
  • 2
  • 11
  • Before saving a varchar type to the db remove a whitespace. You could always do it in the trigger on before insert or update. – Roman C Apr 10 '13 at 08:56
  • No @RomanC if i didn't update address filed still its taking whitespace – Rithesh Apr 10 '13 at 09:01
  • What do you mean by "...when i alter any of the columns the Address column gets wider.."? – Sharun Apr 10 '13 at 09:28
  • In the sense when i update employee details only in address text area whitespace gets added at the start and end so the address column looks expanded – Rithesh Apr 10 '13 at 09:40

1 Answers1

2

If you still need the whitespaces for whatever reasons in the db you can always suppress them using cssStyle="white-space: nowrap; attribute on gridColumn tag.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • No @ Roman C i don't want white spaces in my db. Can you suggest me the solution for that.. – Rithesh Apr 12 '13 at 05:42
  • Look at http://stackoverflow.com/questions/6652687/strip-leading-and-trailing-spaces-from-java-string – Roman C Apr 12 '13 at 09:57