IgGrid - How to connect custom feature chooser to the grid? - infragistics

In my project I use igGrid from ignite-ui. In headers of columns there are gears. If user clicks gear then a popover apears (feature chooser). My task is to implement custom feature chooser - when user clicks on the gear then my custom feature chooser should apear instead of the built-in feature chooser.
I know how to implement the custom feature chooser and options like sorting, grouping, column moving etc. The problem is that I can't find out how to overwrite the gear click event.

You'll have to find the gear icons and unbind mousedown event to prevent feature chooser to pop up.
After that you can bind to mousedown using custom handler to show the custom feature chooser.
rendered: function(e, ui) {
ui.owner.headersTable()
.find("a[data-fc-button]")
.off("mousedown")
.on("mousedown", (e) => {
//open your own featurechooser here
});
},
Here's a fiddle to demonstrate this - http://jsfiddle.net/dkamburov/da276b5w

Related

Foundation 6 drilldown menu: add back event to custom button

The default js-drilldown-back button is not the way I like it.
Instead of having an entire li element for the back functionality I would like to trigger the back event on a custom element.
How to achieve this?
The documentation is everything but clear to me on how to do it: https://get.foundation/sites/docs/drilldown-menu.html#_back
$('#element').foundation('_back', $elem);
What is #element and what is $elem in this context?
For the time being I created an (ugly) workaround:
I let foundation render the default back button but I hide it via css.
My custom back button then triggers that button's event:
$('.drilldown .back').on('click', function(){
$(this).closest('.submenu').find('.js-drilldown-back > a')[0].click();
});
Not great, not terrible.

Qt: Making disabled QAction selectable so the user can toggle it back to enabled

I have a QTreeView and for the items of this tree view, I have implemented a toggle functionality. The user right clicks an item and the context menu shows up, if the user selects toggle, it should toggle the status of the item between enabled and disabled.
I have no problems disabling the item. However, once disabled, even though I set it selectable, the item is still not selectable so the user has no chance of toggling the item back to enabled. Below is how I am currently trying. Any help would be appreciated.
QAction* toggleItem = new QAction("Toggle", &menu);
connect(toggleItem, SIGNAL(triggered(bool)), this, SLOT(toggle_item()));
...
void MyClass::toggle_item() {
bool currentItemStatus = m_selectedItem->isVisible();
m_selectedItem->setEnabled(!currentItemStatus);
m_selectedItem->setSelectable(true);
}
The meaning of a disabled item is exact: it means that the item cannot be interacted with.
If you intend interaction with the item, you must not disable it - that's all. Use another visual indication, perhaps using the foreground and/or background roles.

ZK how to remove waiting actions

I have an textbox with onChange method and button to make some actions. But if I type some thing in textbox and not clicking any where , click that button, It calls onClick method and then onChange method.Or first onChange and then OnClick but I should disable all actions after that onChange method.
Add the check to your onClick() method. The onChange() for a text box is fired after a certain period of time or after you deselect your component. If you deselect your component by clicking on a button it sounds pretty natural to me to get the onClik first and then the onChange. There is no way of controlling (as far as I know) these events, except on server side.
Read this !
Keep in mind that you are developing a WEB application and not a Desktop Application. And event if the development of zk applications may look pretty similar to the desktop applications they are not and they have their limitations.
I found solution :
First for Textbox onFocus method I disable next button , and user cant click it.
Second for Textbox onBlure method I enable next button. (To be fired onBlure action user should click somewhere on window or press tab and this fires onChange action)

QMessageBox addButton() using standard icon/display

I'm trying to make our popup messages boxes have more appropriate text, rather than the generic "Ok", "Cancel", etc. However, I don't see an easy way to get the standard icons on the buttons.
For example, normally the QMessageBox::Save button has an icon with it. Instead I want the text to be "Save Part", but since this is still essentially a save operation it'd be nice to have the same icon.
I'd be happy to have this tied to the Role, as all my custom test buttons map to one of the standard roles. Is there any easy way to get the standard icons onto the custom buttons?
If you just want to change the text on the StandardButton but keep the standard icon you can do the following:
QMessageBox *box = new QMessageBox("title", "text", QMessageBox::NoIcon, QMessageBox::Save, QMessageBox::Close, QMessageBox::Open);
box->button(QMessageBox::Save)->setText("Save part");
box->show();
This will result in following:
And the button will keep the same role
Add a button with QMessageBox::addButton to QMessageBox, then call the Button's setIcon with the icon returned by the QStyle::standardIcon you want.

How do I change properties of buttons within button boxes in Qt Designer?

I have been searching online to no avail. Does anyone know how to access a button in a button box (created using the "Dialog with Buttons Right" template)?
In Designer, select the OK or Cancel button. Then open the property editor and scroll down to the QDialogButtonBox section. You can then expand the standardButtons item to see the various buttons that are available. Other properties, such as the centerButtons property, are also available.
However, designer gives you very little control over the button box.
In code, you can do many other things, such as change the text that appears on the "standard buttons." From the documentation:
findButton = new QPushButton(tr("&Find"));
findButton->setDefault(true);
moreButton = new QPushButton(tr("&More"));
moreButton->setCheckable(true);
moreButton->setAutoDefault(false);
buttonBox = new QDialogButtonBox(Qt::Vertical);
buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
As long as you give the button box a name in designer, you can set these properties in code.
I am writing this answer for the Python community. I am using PySide and faced a similar problem. I have a QDialogButtonBox and I would like to have my own buttons instead of the default ones.
I am using PySide which is more or less the exact replica of the c++ code, so I believe other c++ developers can also get something from it.
Here how I would do that:
my_ok_button = QtGui.QPushButton("My Ok Button")
my_cancel_button = QtGui.QPushButton("My Cancel Button")
ok_cancel_button = QtGui.QDialogButtonBox(QtCore.Qt.Horizontal)
ok_cancel_button.addButton(my_ok_button, QtGui.QDialogButtonBox.ButtonRole.AcceptRole)
ok_cancel_button.addButton(my_cancel_button, QtGui.QDialogButtonBox.ButtonRole.RejectRole)
I would then insert my button box to my layout like ususal:
layout.addWidget(ok_cancel_button, 1, 1)
Now later in my code I can do anything with my button. Lets change its name:
my_ok_button.setText("Some Other Name")
So then things to note here is that:
you must set the role of the buttons in the addButton() method if you
want to use functionalities given by standard buttons. E.g. if you
wish to do something like below, you need to have the button roles
set.
ok_cancel_button.accepted.connect(self.ok_method_handler)
ok_cancel_button.rejected.connect(self.close)
More information can be found here.