JQGrid How to set imgpath or how to specify the location of images folder

心不动则不痛 提交于 2019-12-25 05:26:34

问题


I am new to jqgrid and i was going through the jqgrid tutorial. i tried to set the imgpath but it does not work. i dont want to have all the images in the current directory. how do i define img path in jqgrid ? I did some research and the imgpath attribute may be deprecated (they still have it on the jqgrid wiki though !)

I am using the latest version of JQGrid. How do I specify the path to the images folder in this version ? Right now, I just copy the image folder where all my CSS files are and this works. Is there any other way. The problem is that in our project we have a designated images folder which is shared by all other applications and I am required to only use that folder.

please help.

thanks


回答1:


Starting with jqGrid version 3.5 it uses jQuery UI CSS Framework. It means that jqGrid don't have any images. So the imgpath option of jqGrid is deprecated (see documentation).

If your web server is in internet I don't recommend you to copy CSS images to your web site. You can just include the reference need to include jquery-ui.css from some CDN location. For example from http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css:

<link rel="stylesheet" type="text/css"
      href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" />

The file jquery-ui.css contains relative paths to all images. For example url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) which absolute location is http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png. So if you do need to include the copy of CSS and the images you have to place images folder relative to the path of jquery-ui.css.



来源:https://stackoverflow.com/questions/17344213/jqgrid-how-to-set-imgpath-or-how-to-specify-the-location-of-images-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!