Change jQuery grid theme (location ui.jqgrid.css) in struts2

I have a jquery grid component in my webpage. I want to change the css file that it uses. I installed it in jj: head tag:

<sj:head jqueryui="true" jquerytheme="custom-theme" customBasepath="css"/>

And I see this html tag on my webpage:

<link type="text/css" href="css/custom-theme/jquery-ui.css" rel="stylesheet" id="jquery_theme_link">

The stylesheet path for the jquery-grid component is

<link rel="stylesheet" type="text/css" href="/appname/struts/themes/ui.jqgrid.css">

I want this path to be as follows:

<link rel="stylesheet" type="text/css" href="css/custom-theme/ui.jqgrid.css">

Where can I set the location of the css file for jQuery grid?

+5
source share
2 answers

I had the same problem, the solution was to override css after loading the grid.

<sjg:grid 
    ...
    onCompleteTopics="loadCustomCss"
    ...
/>

Then in your jsp

<script>
    $.subscribe('loadCustomCss', function(event,data){
         $('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href', '../css/grid.css') );
    });
</script>

Where grid.css is your custom css, you can copy the css provided by the plugin, and this is especially useful when you downloaded it as a dependency on Maven.

+1

:

<sjg:grid ... onGridCompleteTopics="myCssLoaderTopic" ....> 

<script>
    $.subscribe('loadCustomCss', function(event,data){            
        $.struts2-jquery.requireCss(cssFile, basePath); 
    });
</script>

: https://groups.google.com/forum/#!topic/struts2-jquery/Aurqeuwhiuo

+1

All Articles