Right now, the boolean fields in the edit forms in activeadmin are rendered so that clicking on the whole row where the checkbox is positioned can change the checkbox value. So not only on the checkbox and its label but also on all the space left and right to it.
But I want to make just the checkboxes clickable, not the entire line. How is it possible to implement this?
add this to active_admin.scss file
form fieldset > ol > li.boolean label {
width: auto;
margin-left: 20%;
padding-left: 0px;
}
this will work then with just the checkbox and the text and not all the line for both sides.
Related
When Vaadin 8 Grid is set to be multi-selection mode using setSelectionMode(SelectionMode.MULTI), a column is added on left of the Grid with a checkbox on each row.
I am OK with this selection method, but the caption of each checkbox such as "Selects row number 2" etc. is really not necessary. Is there an easy method to remove these checkbox captions?
Yes, there is a caption, but it should not be visibile. It is accessibility feature. It seems that you have something wrong with theme and styles, as this label should not be rendered in viewport. So it should not be visible, it is just for screenreaders so that blind people could use the selection. See the screenshot how DOM should look like.
I change added .v-assistive-device-only-label that has all the same rules as in .v-assistive-device-only. Now, both the check square and caption are gone, leaving a empty cell to select. I'd like to learn how to make only the check square to show up but not the caption, if possible.
You need to include label element in the css selector. As you see label is a child element of the element having .v-assistive-device-only-label class name. If you target .v-assistive-device-only-label, it the css is applied to that element and thus also the checkbox which is its child is affected too. But when you add label, the css applies only for the label which is child of .v-assistive-device-only-label
.v-assistive-device-only-label label {
position: absolute;
top: -2000px;
left: -2000px;
width: 10px;
owerflow: hidden;
}
<xe:namePicker id="npUserNames" for="hdnUserNames">
<xe:this.dataProvider>
<xe:dominoViewNamePicker viewName="Techs"></xe:dominoViewNamePicker>
</xe:this.dataProvider>
</xe:namePicker>
The Names in the left box of the dialog are center aligned. Same with the right (selected values) box.
I have tried text-align: left css in every possible surrounding element...The table cell, the table it is in, the surrounding div tag, the panel, the layout, the entire xpage. And the content of the namepicker dialog is still centered. How do I fix that? How can I specify the width of the dialog box?
Also, in IE11, the "X" button does not work. Nothing happens when you click it.
I'd recommend interrogating the HTML generated using your browser's developer tools to see if there's a class defined for the relevant HTML tags that you can override. If so, you can use that. If not, you may need to create your own Renderer or extension of the Name Picker to generate different HTML. That will be more complicated, but the trade-off of any framework is limited configurability at the cost of quicker development.
I'm not doing exactly what Withers suggested, but it did lead me to a solution based on a comment somewhere else.
I added a class dojo attribute and assigned a new css class to it. Only issue is that it is shifting everything in the dialog to the left...but it's ok for now.
<xe:this.dojoAttributes>
<xp:dojoAttribute name="class" value="namePickerClass">
</xp:dojoAttribute>
</xe:this.dojoAttributes>
CSS:
.namePickerClass { margin: 0 auto; width: 50%; text-align:left; border: 1px solid blue; scrolling: none;
}
I'm trying to disable the checkbox on a specific row based on some property of it's Bean (or just make the whole row generally unselectable), but I can't really see any method or property I could use to get a handle of the checkboxes on the left hand side added when using a multi-selection model or something as broad as disabling the whole row. Any thoughts on how this could be achieved, or where I should be looking?
You can use CSS to hide uncheckable rows. First set their styles using setRowStyleGenerator:
grid.setRowStyleGenerator(row -> {
boolean uncheckable = (Boolean)
row.getItem().getItemProperty("uncheckable").getValue();
return uncheckable ? "uncheckable-row" : "";
});
Then change styles in your .scss, they should look something like:
.v-grid-row.uncheckable-row td {
background: #b1b9d6 none repeat scroll 0 0;
}
.v-grid-row.uncheckable-row td:first-child {
visibility: hidden;
}
.v-grid-row.uncheckable-row.v-grid-row-selected > .v-grid-cell {
background-image: none;
border-color: #d4d4d4;
color: inherit;
text-shadow: inherit;
}
Here I hide the whole cell with checkbox (if hiding the content of td itself, user will still be available to select the row), use a different color for these rows and prevent them from being highlighted when "select all" checkbox is active. Surely, further styling is available. Since we only hide them from user, they still can be selected with grid.select() and located in grid.getSelectedRows() collection, you should filter them manually (by using some "uncheckable" property, as shown above).
It is not possible to disable checkbox on a specific row.
One solution is to use generated column and/or custom renderer.
if you are using twitter bootstrap as your responsive framework, you should be able to find that row and give it a class of ".inactive", and if that doesn't work you can always rig it but placing and absolute positioned box with a height and width of 100% inside of that row and z-index it to at least 250. That should make everything in that row un-clickable!
I figured that this would be a common need, but have been unsuccessful in finding a solution. I followed this ASCIIcast by Ryan Bates http://railscasts.com/episodes/302-in-place-editing?view=asciicast and now have functional in place editing on my website. However, I think it is not intuitive that these records are editable at all, as they just appear as a plain text representation of the current record value until you click them. I want something so that the select dropdown shows up by default like it would in a normal form as shown in the image. Is there anyway to do this using best_in_place or rest_in_place?
I know it is not exactly the answer you are looking for but you can style the best_in_place values using the .best_in_place class.
I did something like this on my website, which helps showing that the value is editable:
.best_in_place {
padding-right: 18px;
background-image: url('*/ link to an edit icon /*');
background-size: 15px auto;
background-position: right center;
background-repeat: no-repeat;
cursor: pointer;
}
.best_in_place:hover {
background-color:#eeeeee;
}
What i think you want to do is to find the styles that are applied to the hover state of the element, and copy them to the normal state of the element too.
In chrome inspector:
Right click on the select tag and choose "Inspect element"
Right click on the element as seen in the "Elements" tab and choose "Force element state" and then "hover"
On the right of the inspector now you should see the styles that are applied to the :hover state of the element. Copy these into your stylesheet and remove the ":hover" part from the end of the rule. You might need to add some extra selectors to the rule to make sure you don't do this for all selects across your entire site.
A dropdown is the default behavior for best_in_place if your original form input is via radio buttons. Otherwise, you can use a :colllection to at least validate the new data entry.
e.g. in haml, updated answer must be red, green or blue:
.flex1=best_in_place :color, :type => :select, :collection => (["red","blue","green"])
please see this http://jsfiddle.[net]/Nkkzg/108/ (SO doesn't allow to like to JsFiddle) and write 'Apple' in auto-complete text box. You can see a long string appears and with that page's horizontal scroll bar also appear which is very annoying.
I want to show the full string as a result without setting the width, You can see autocomplete results div shows from the left corner to maximum right depending on string length. How can we show the results in the center of page like input textbox, so that horizontal scroll bar shouldn't appear.
Any help will be highly appreciated.
Thanks and Regards.
According to this article:
jQuery UI Autocomplete Width Not Set Correctly
It looks as though you need to place everything in a container and specify the appendTo property telling it where to put the menu.
You should try to use position:absolute
.ui-autocomplete {
max-height: 200px;
overflow-y: auto;
/* prevent horizontal scrollbar */
overflow-x: hidden;
border:1px solid #222;
position:absolute;
}
Live Demo
You could try to put this in your .css file
span input.ui-autocomplete-input {
width: 100%;
}
In that way the autocomplete get's the width you have style it to according to the styleClass that is on the enclosing span tag