无法在jqgrid上看到图像/图标 [英] Unable to see Images/icons on jqgrid
问题描述
我在我的Asp.net MVC Web应用程序中使用JqGrid。
I am using JqGrid in my Asp.net MVC Web Application.
我已将所有java脚本文件放在 Scripts $下根据普通MVC应用程序的目录结构,c $ c>文件夹以及
Content
文件夹中的所有css和图像。
I have placed all the java script files under Scripts
folder and all the css and images in the Content
folder as per the directory structure of an normal MVC Application.
但问题是,我无法在网格上看到图像。 CSS工作正常,但分页,排序的图标不可见。
But, here the problem is that i was not able to see the images on the grid. the CSS is working fine but icons for paging,sorting are not visible.
任何人都可以帮助我如何放置文件,以便每件事情都能完美运作..
Can any one help me on how the files should be placed so that every thing works perfectly..
代码:
<link href="../../Content/css/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<link href="../../Content/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="../../Content/css/jquery.ui.theme.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="../../Scripts/grid.locale-en.js" type="text/javascript"></script>
推荐答案
我想你以错误的方式添加jQuery UI到你的项目。您应该验证是否在 Content\css
文件夹中复制了 images
jQuery UI Theme的子文件夹。如果您打开 jquery-ui.css
并搜索 url(
文本,您将看到 jquery-ui.css
使用相对路径来寻址图像(例如 url(images / ui-bg_inset-hard_100_fcfdfd_1x100.png)
)。所以你必须拥有 images
文件夹,其中包含所用主题的所有jQuery UI图片。
I suppose that you add jQuery UI in a wrong way to your project. You should validate that you copied images
sub-folder of jQuery UI Theme in Content\css
folder. If you opens jquery-ui.css
and search for url(
text you will see that jquery-ui.css
uses relative paths to address images (for example url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png)
). So you have to have images
folder with all jQuery UI images from the Theme used.
顺便说一句,如果你使用 jquery-ui.css
,则不需要包含 jquery.ui.theme.css
使用旧的 jquery-1.9.0.min.js
在我看来也不是最好的选择。而不是你可以使用jQuery 2.0.3(或者1.10.3如果你需要支持IE 6-8)或至少jQuery 1.9.2。
By the way including of jquery.ui.theme.css
is not required if you use jquery-ui.css
from the same theme. Usage of old jquery-1.9.0.min.js
seems to me not the best choice too. Instead of that you can use jQuery 2.0.3 (or 1.10.3 if you need support IE 6-8) or at least jQuery 1.9.2.
我个人更喜欢使用NuGet将公共包添加到Visual Studio项目中。您只需在Visual Studio的解决方案资源管理器中打开Project的上下文菜单,然后选择Manage NuGet Packages ..。然后您可以在线搜索公共包,例如 jQuery
, jQuery.UI.Combine d
, jQuery.UI.Theme.Redmond
, Trirand.jqGrid
等等。 NuGet会将所有文件安装在项目的相应文件夹中。文件夹位置由软件包的开发人员选择。即使您手动安装某些文件,我也建议您使用所有文件的相同位置,例如NuGet包使用的位置。
I personally prefer to use NuGet to add public packages to Visual Studio project. You need just open context menu of you Project in Solution Explorer of Visual Studio and choose "Manage NuGet Packages..". Then you can search online for public packages like jQuery
, jQuery.UI.Combined
, jQuery.UI.Theme.Redmond
, Trirand.jqGrid
and so on. NuGet would install all files in the corresponding folders of your project. The folder location was chosen by developer of the packages. Even if you would install some files manually I would recommend you to use the same locations of all files like the locations used by NuGet packages.
这篇关于无法在jqgrid上看到图像/图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!