Author Topic: Changing styles of select component  (Read 10563 times)

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Changing styles of select component
« on: May 10, 2015, 06:17:52 pm »
Hi,

I have added the selector to my application. However, when I apply the css for all like the following, I get the whole page elements get affected.
<style type="text/css">
         *{
                padding:0px;margin:0px;
            font-size:12px;
            font-family:Verdana, Geneva, Helvetica, sans-serif;
                line-height:20px;                            
         }
         
           
      </style>

I tried to apply the class or some style using some javascript code and jquery but they failed. so can you advise how to change the css custom things, not changing the jquery in the import url, so I can set myspecific border color and keep the rest as is, similarly, changing the background color.

Please advise.

Regards,
Ridwan Habbal

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #1 on: May 11, 2015, 11:06:25 am »
Hi everybody...
Can't anyone give a hint regarding this?
Thanks for help in advance
Ridwan

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6308
    • View Profile
Re: Changing styles of select component
« Reply #2 on: May 11, 2015, 11:43:41 am »
Here is an example jsfiddle on how to change css rules of common classes in pqSelect.

http://jsfiddle.net/dLvx6u63/10/

And the classes are documented here:

https://github.com/paramquery/select/wiki/Css-customization
« Last Edit: May 11, 2015, 11:46:24 am by paramquery »

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #3 on: June 14, 2015, 12:58:32 pm »
Thanks for the help.

I have another issue. When I apply the searchable combo style to a select item it works fine, however, when I apply it inside a div that is configured to work as a modal popup it fails. I tried to see which attribute of the style of the enclosing div conflicts and it turned out it is : display. when display=none, I get the problem. the css for the modal popup is

.popupDialogClass{
   background-color:white;
   display:none;
   padding: 10px;    
   border: 2px solid #ddd;
   float: left;
   font-size: 1.2em;
   position: fixed;
   top: 50%; left: 50%;
   z-index: 99999;
   box-shadow: 0px 0px 20px #999;
   -moz-box-shadow: 0px 0px 20px #999; /* Firefox */
    -webkit-box-shadow: 0px 0px 20px #999; /* Safari, Chrome */
   border-radius:3px 3px 3px 3px;
    -moz-border-radius: 3px; /* Firefox */
    -webkit-border-radius: 3px; /* Safari, Chrome */
}
when I set display=block it works fine, however, I have to set display =none because the modal popup is initially closed.

Any hint?
Thanks
Ridwan

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #4 on: June 15, 2015, 04:27:44 am »
Hi everybody
Any hint? Hope you help me
Thanks
Ridwan

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6308
    • View Profile
Re: Changing styles of select component
« Reply #5 on: June 15, 2015, 06:45:51 pm »
pqSelect being a js control can't display correctly when its ancestor is hidden ( display none ).

Solution is to call refresh on pqSelect when dialog is shown.

http://paramquery.com/api/select#method-refresh

http://api.jqueryui.com/dialog/#event-open

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #6 on: June 16, 2015, 12:28:14 pm »
Thanks for the help. It works now
One more issue is now, the combo box get appeared however, the drop down menu that contains the elements is getting displayed behind the popup. I tried to play with z-index property and make the z-index of (.pq-select-menu, .pq-select-popup) higher than the popup css class. but no hope.
maybe I applied it incorrectly or maybe you have another solution.

Thanks in advance
Ridwan

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6308
    • View Profile
Re: Changing styles of select component
« Reply #7 on: June 17, 2015, 02:59:30 pm »
Try to set z-index of .pq-select-popup-cont higher than the popup, though its z-index is already set to z-index:10000; which should work unless popup in your case has z-index more than 10000.

If still doesn't work please share a jsfiddle so that I can look into it.

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #8 on: September 13, 2015, 04:46:33 pm »
Hi,

Thanks for support. I have another issue now. The issue is that I have some select item to be disabled / enabled based on specific input. I could archive that by calling:
$("#recievingMethodId").pqSelect("enable");
$("#recievingMethodId").pqSelect("disable");
However, the style that gets applied when the multiple select item is disabled needs to changed to look like the style I apply for other regular items.
When the item is enabled the style looks ok. Only when it's disabled.

Thanks in advance.
Ridwan

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #9 on: September 14, 2015, 12:34:28 pm »
Hi everybody... anybody would like to help please?

ridwanhabbal

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Changing styles of select component
« Reply #10 on: September 15, 2015, 10:30:42 pm »
Hello, is there someone who would like to help me? Please

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6308
    • View Profile
Re: Changing styles of select component
« Reply #11 on: September 15, 2015, 10:40:13 pm »
ui-state-disabled class is added to the control when it's in disabled state.

So you can define custom css rules for the class combined with control to change its style.

.pq-select-button.ui-state-disabled{
 /*define your css rules*/
}