Bootstrap-select - Don't show selected value - icons

I'm using bootstrap-select to create my selectpicker.
I set an icon for the select using :
data-style="glyphicon glyphicon-list"
When I'm selecting an option, the option selected is place near the icon but I don't want that.
I don't want to see the selected option, only the icon.
Two printscreen to illustrate :
Before =>
http://hpics.li/07182fd
After =>
http://hpics.li/c1dd1ca
Thank you !

I found a way !
My code :
$('select.selectpicker').on('change', function(){
$(".glyphicon-list .filter-option.pull-left").empty();
});
glyphicon-list is the class of the button.btn.dropdown-toggle.selectpicker.

Related

How do I add style names to grid rows without selecting them?

I want to style a grid row after clicking on it. I get the grid row / item in the itemClickListener, but I need to avoid using grid.select(item). I have achieved the desired output which would highlight the row I clicked on with the grid select method, but this causes problems for my app since I do not want that row to be selected, but I want it to be just highlighted, e.g. apply a CSS style to said row. This is my code so far:
grid.addItemClickListener(e -> {
grid.deselectAll();
grid.select(e.getItem());
});
as well as:
grid.setStyleGenerator(row -> grid.getSelectedItems().contains(row)
? getRowSelectedStyle(row)
: null);
I cannot seem to find anything on the forums which could apply a style name for the clicked row.
You probably need to add a property to your item Bean, se "clicked".
Then you could do
grid.addItemClickListener(e -> {
e.getItem().setClicked(true);
grid.getDataProvider().refreshItem(e.getItem());
});
And
grid.setStyleGenerator(row -> row.isClicked()
? getRowSelectedStyle(row)
: null);

Qt: Map a clicked signal to another button

I wanted to have a collapsible widget. I used this code: How to make an expandable/collapsable section widget in QT.
I wanted the title of the QToolButton to be on the far left and the triangle icon to be on the right. I deleted the title, and moved the icon. Then I created a QPushButton and made it look like a QLabel and positioned it where I wanted the title to be. Now, I would like the title to be clickable - to have the same effect as clicking on the toggle icon would have. How do I connect these two signals?
Code for the QToolButton:
QObject::connect(toggleButton, &QToolButton::clicked, [this](const bool checked)
{
toggleButton->setArrowType(checked ? Qt::ArrowType::DownArrow : Qt::ArrowType::UpArrow);
toggleAnimation->setDirection(checked ? QAbstractAnimation::Forward : QAbstractAnimation::Backward);
toggleAnimation->start();
});
You can also write it like this:
QObject::connect(titleLabel, &QPushButten::clicked, toggleButton, &QToolButton::clicked);
I found that this works:
QObject::connect(titleLabel, &QPushButton::clicked, [this]
{
toggleButton->click();
});
Disclaimer: I have no idea if that is the correct way to do this.

Summernote has uneditable inputs in modals with dialogsInBody

I have one instance of summnernote in jQuery UI dialog.
By default all summernote's modals look like this:
But when I remove <div class="modal-backdrop in"></div>, I can write into all inputs in these modals:
Well, I've found a solution with dialogsInBody:
$('someTarget').summernote({
dialogsInBody: true,
... //another options
});
But when I turn it on, all text inputs inside the summernote's modals are uneditable! I can interact with checkboxes and file inputs, even the cursor changes to "text", but I am not allowed to write anything into text inputs:
I've inspected, there aren't any blocks over them. And I can't find any extra styles to block inputs (e.g. like pointer-events).
What does exactly do option dialogsInBody? Why inputs aren't editable?
Ok, I've resolved this problem by myself.
There are details:
In summernote.js there are such usage of dialogsInBody:
var $container = options.dialogsInBody ? $(document.body) : $editor;
Therefore modal window appends itself to body (instead summernote editor) when we set {dialogsInBody:true}. Nothing else.
Jquery UI Dialog has a behavior that blocks all text inputs outside of itself (see this). So when summernote is opened inside ui-dialog all of its modals has uneditable inputs.
My solution is to exclude all inputs in summernote modals from list of disallowed items. it required to override a dialog method _allowInteraction:
//fix problem that block inputs in modal dialog outside main UI Dialog
if ($.ui.dialog.prototype._allowInteraction) {
var originalAllowInteraction = $.ui.dialog.prototype._allowInteraction;
$.ui.dialog.prototype._allowInteraction = function(e) {
var isInModal = $(e.target).closest('.modal-dialog').length > 0;
return isInModal || originalAllowInteraction(e);
};
}

a href and html.actionlink size not same

If i use below , button display bigger.
<i class="icon-plus"></i>Add
If i use below , button display smaller than above code.
#Html.ActionLink("Add", "xx", "Law", new { _lawfileid = -1, baseappid = ((ObjectModelLibrary.Law)ViewData["currentLaw"]).LawID }, new { #class = "btn btn-primary icon-plus" })
How can i change Html.Actionlink like a href i ?
What is difference between actionlink and href or how can i set same size for both ?
The reason for your issue is that in the first line of code you have an element inside another element. Whereas in the second line of code you have a single element with extra class.
Similar question is already answered on stackoverflow. Please find the link below
Create an ActionLink with HTML elements in the link text
Since you need to build an element inside an element use #Url.Action as mentioned in the above link.

Tabris Button Height

I'm trying to make a multiline button, but the text gets cut off.
Button button = new Button( containerButton, SWT.PUSH );
button.setText( "Hello\nWorld" );
Is it possible to adjust the height of a button?
The only thing I found was setSize( width, height ) but that's not working.
Thanks!
Toby
Try to give the button a layout data e.g. a GridData. Here you can set e.g. the heightHint. This should work.
Maybe a good article to read would be:
http://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html

Resources