I am using jqGrid 3.5. Can I change the style and look of the grid and make it more beautiful using jQuery or custom CSS or something else?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
I'm sure you can.
You have two options:
You can modify the CSS of the grid. This is useful if have to make small modification on the design. The major modifications shouldn't be done this way because the JQGrid's CSS classes are really dependent on each other.
Or you can remove all the styling from the HTML and replace it with your own.
For instance you have a JQGrid like:
HTML
jQuery
This will generate HTML like below:
Remove all the CSS classes:
etc.
After you created your own classes you can add to the HTML structure with:
I suggest to use both techniques.
I have modified css of jQGrid in a new way, that will support bootastrap design also. You need following things to configure this jQGrid
1) Font Awesome Style
2) jQGrid Latest bundle
New designed jQGrid will look like below image
New full CSS and full javascripts coding is included http://www.techdoubts.net/2015/11/working-jqgrid-responsive-css-boostrap.html here.
You would need to change the grid header (on-the-fly).
This is my code
The HTML:
The jqGrid:
In order to understand which object I have to work in, let's inspect the HTML code generated by the JavaScript code:
...
Now, the only div with an ID specified is the <div id="gview_jqgrid_ctrs"...
That's why the following DOESN'T WORK.
I had to select the parent div and "search into" the header div, having the "ui-jqgrid-titlebar" class specified. Then I removed the original "ui-widget-header" class and replace with my own class.
Where .jqgrid-header is a style defined in this way.
I've tested this and works. Hope this will be useful...
You can remove all ui-grid classes:
This may have performance issues if your grid size is big.
To elaborate on what Justin Ethier says...
Since jqGrid uses Jquery-UI themes, the best way to change the appearance of the grid would be to make a custom theme.
I would strongly recommend that you see if that works for you before attempt to modify the css after the fact... although you can do that as well, if the jquery-ui theme look is too confining for you.
One of the big features of jqGrid 3.5 is integration with jQuery UI Themes. You can build and/or select a theme from here. Then just add a reference to it in your page:
This will get you a grid that looks very good, with a minimum of effort.
Does that solve your problem or do you need to overhaul the grid look-and-feel even more?