1

In my jqGrid I am defining editable column with edittype :'select'. I am using inline editing. I want to assign option element to this drop down with string

for example

1:SA<br>21;2:SH<br>22;3:GT<br>23 

When I assign such string to value attribute of editoptions of this column I am getting option element in drop down as follows SA undefined undefined SH undefined undefined GT undefined undefined

Can anybody suggest me how to overcome this problem.

Shaggy
  • 315
  • 2
  • 9
  • 23

2 Answers2

2

I suppose that your problem can be solved by usage delimiter property which replace default ; separator used by jqGrid to any another symbol, for example to ? in the code below:

editoptions: {
    delimiter: "?",
    value: "1:SA&lt;br&gt;21?2:SH&lt;br&gt;22?3:GT&lt;br&gt;23"
}

Of cause you should replace additionally <br> to some encoded version like &lt;br&gt;.

UPDATED: The demo demonstrate that above suggestion works.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi with this I am able to searate the option element correctly but the option text get created like SA <BR> – Shaggy Jan 17 '14 at 18:51
  • 1
    @Shaggy: I can' t reproduce the problem which your describe. See **UPDATED** part of ma answer with working demo. – Oleg Jan 17 '14 at 20:05
  • Actually I was replacing the
    tag from server side string.Replace() which was causing
    to get replaced as &ltBR&gt. So i tried it replacing from javascript which worked perfectly for me. Thanks For your support.
    – Shaggy Jan 20 '14 at 09:27
  • One more problem I would like to share with you [here] (http://stackoverflow.com/questions/21230875/jqgrid-datatable-not-rendered-properly-in-ie8-with-jqgrid-version-4-5-4). Its related to jqGrid 4.5.4 compatibility with IE8 browser. – Shaggy Jan 20 '14 at 09:57
0

You have to do a replace on the <br> and make them \n

see this guys answer, maybe you can use his code to do the replacement

Look at JQuery's .html(), you will also be able to use that.

Community
  • 1
  • 1
Pierre
  • 8,397
  • 4
  • 64
  • 80
  • Thanks for your reply but I need to show there
    tag. I don't want content after br tag to be arear on new line. I tried replacing < with < & > with > but by ; jqGrid treats it as new option element to create.
    – Shaggy Jan 17 '14 at 18:01