admin管理员组文章数量:1241061
I want to change the CSS of the add form of the jqGrid. Are there any methods available for changing the plete CSS in the linking of the add form for the jqGrid?
I want to import another CSS file for the add form and apply for that add form.
I want to change the CSS of the add form of the jqGrid. Are there any methods available for changing the plete CSS in the linking of the add form for the jqGrid?
I want to import another CSS file for the add form and apply for that add form.
Share Improve this question edited Jul 8, 2013 at 6:27 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Aug 13, 2012 at 6:11 Bhavik AmbaniBhavik Ambani 6,65715 gold badges57 silver badges87 bronze badges 6- this could be helpfull stackoverflow./questions/1415439/change-style-of-jqgrid – themhz Commented Aug 13, 2012 at 6:18
- I want to change the style of add form for the jqgrid not the grid css – Bhavik Ambani Commented Aug 13, 2012 at 6:20
- Please post your HTML code here. – Piyush Sardana Commented Aug 16, 2012 at 11:43
-
I am using
JQgrid
ofJQuery
and I want to change the style/css of the add form which es when we press+
button of the grid. – Bhavik Ambani Commented Aug 16, 2012 at 12:48 - 1 you see this question stackoverflow./questions/1308369/… add form or edit form, look at the html they generate, I'm pretty sure this question and the one you asked earlier on which Oleg replied will solve your problem. If they don't put some code and tell us that this is what you wanted and this is how its working. Theoretical questions are not good Bhavik. I'm pretty sure if you put some code about how you tried to change css in your previous question Oleg can help you further on that. – Piyush Sardana Commented Aug 16, 2012 at 13:36
5 Answers
Reset to default 5All CSS styles which uses jqGrid for the add/edit forms you can find here and here. If you would examine the lines and examine the HTML fragment of any jqGrid form you would see all classes used by jqGrid.
I don't understand only what you mean under "to import another css". The "import" would works only if you have somewhere another CSS styles with the same class names and the same hierarchy of the elements (dives, tables, tr and so on elements). So it's possible to change the styles of forms used by jqGrid, but the adjustment of the styles will be not so easy. You have to examine the structure of the jqGrid dialogs (forms) exactly to be able to make the changes.
UPDATED: jqGrid uses jQuery UI styles. So you need just change the jQuery UI to another one and jqGrid will use it.
For example the demo (simple modification of the old demo from the answer) produce the following Edit form:
In your case, I suggest you to add id
to the <body>
tag and change it instead of changing files. You can manipulate it by adding .bodyClass1
before your CSS selectors in each file.
EXAMPLE
style1.css
.bodyClass1 .C1{ ... }
.bodyClass1 .C2{ ... }
style2.css
.bodyClass2 .C1{ ... }
.bodyClass2 .C2{ ... }
So, at the moment when your HTML use style1.css
and you want change it for style2.css
, you need just use:
jQuery
$('body').removeClass('bodyClass1');
$('body').addClass('bodyClass2');
Try with $('#myItemID').css( propertyName , value )
You can't change the stylesheets without affecting the whole page.
The only way I can think of to achieve this would be to use an iframe, but it would be a bit clunky.
You could add a class to a parent div, and then change the css files to be something like
.sheet1 .c1 {
border: 1px solid #000
}
in the first sheet and
.sheet2 .c1 {
border: 3px solid #f00;
}
in the second. Then your markup would be:
<div class="sheet1"> <!-- parent div -->
<div class="c1">Hello!</div>
</div>
Change the class sheet1
in the parent div to sheet2
and the child div will change.
You can't apply different stylesheets to different parts of a page.
You would be better off having two classes in your css file such as C1 and C2 and then just changing the class of the relevant div by targeting it with an id such as:
<div id="mydiv" class="c1"> </div>
$('#mydiv').addClass('c2');
$('#mydiv').removeClass('c1');
本文标签: javascriptChange CSS of the add form using jqGridStack Overflow
版权声明:本文标题:javascript - Change CSS of the add form using jqGrid - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740071715a2223091.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论