I want to create a custom filter for my DataTable. I would like to create a button that, when clicked on it, changes the table its data. I know about the ChoiceFilteredPropertyColumn that wicket has to offer but this is, according to my understanding of it, a dropdown filter.
I am trying to achieve something like the following picture (Pancakes is the clickable button):
Could someone point me in the right direction?
Well... the superclass of ChoiceFilteredPropertyColumn is FilteredPropertyColumn which might do the trick. Otherwise you could always implement your own Column that implements IFilteredColumn the way you like it.
Look at how the implemented `DataTable' here: http://www.packtpub.com/sites/default/files/1605OS-Chapter-5-Displaying-Data-Using-DataTable.pdf
Then you could implement your dropdown button filter like you want it and filter with the selected value the DataTable.
I solved this question by creating a custom filter (just a panel with some markup) and return it in the getFilter method of a custom FilteredPropertyColumn.
FilteredPropertyColumn:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilteredPropertyColumn.html
getFilter method:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/IFilteredColumn.html#getFilter%28java.lang.String,%20org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm%29
ButtonFilter class:
public class ButtonFilter extends Panel {
...
}
In custom FilteredPropertyColumn class:
#Override
public Component getFilter(String componentId, FilterForm<?> form) {
return new ButtonFilter<Y>(componentId, getFilterModel(form), filterChoices);
}
Related
I am implementing a category mapper. There are 2 TreeViews. Both contain categories from different sources. (Even they look like from the same source)
The user should be able to map ONE category from the left to multiple of the right treeview. This gets stored in a config file.
However, when the view is initially loaded and the user clicks on a category on the left, I want to preselect the mapped categories on the right, loaded from the config file.
I saw that I can do this with ONE selection, but I don't see an option to do this for multiple ones.
How can I achive this?
Here a ootb running demo implementation
I went through your gist and it seemed that the problem was binding selections right? I did some light digging and found that binding observable lists isn't easy. I don't think I even saw a solution that wasn't just adding listeners to mock a binding. However, wrapping that list in a SimpleListProperty seemed to do the trick. Here's a demo:
class TestView : View() {
// This mocks your target list in the ViewModel
val targetList = SimpleListProperty(listOf<String>().asObservable())
override val root = vbox(10) {
// Both table views and tree views use an Observable Selection list
listview(listOf("asefas", "asefasef", "asefasefasefase").asObservable()) {
// Wrap in SimpleListProperty, then bind
targetList.bind(SimpleListProperty(selectionModel.selectedItems))
selectionModel.selectionMode = SelectionMode.MULTIPLE
}
setPrefSize(300.0, 300.0)
}
init {
// Target list now reflects changes made to selection model
targetList.addListener { _, _, change ->
println("Selections changed to: $change")
}
}
}
I have a RunBaseReport which contains overrided dialog method where I'm adding couple of my controls. One of those controls is a combobox.
Controls enabled() property should be changed when I'm modifying combobox.
So basically I need to know when the value of my dfReportType dialog field changes.
public Object dialog(Object dialog)
{
DialogRunbase dialog = dialog;
;
//adding my combobox
dfReportType = dialog.addFieldValue(typeid(ReportType), ReportType:DefaultType);
//adding some other controls here
return dialog;
}
According to many articles that I found I need to override dialogPostRun Method and do something like this:
public void dialogPostRun(DialogRunbase dialog)
{
super(dialog);
dialog.dialogForm().formRun().controlMethodOverload(true);
dialog.dialogForm().formRun().controlMethodOverloadObject(this);
}
But unfortunately I don't have this method in RunBaseReport class.
Which should be there according to msdn .
Are there any other workarounds?
I'm currently on AX 2012 but I still looked at it. I have the method available in the context menu, but not on the first column. I have to go over "Plus..." to find the method in the second column.
Well, there is no dialogPostRun method in Report object that inherits RunBaseReport, but we have this method in Class that inherits RunBaseReport.
So that was my mistake. I used report object instead of class.
If you want to make custom dialog for the report but you also want to use all default controls you should:
Create class
Inherit RunBaseReport
Override dialog, getFromDialog etc.
Override lastValueElementName method
public identifiername lastValueElementName()
{
//just put name of your report object
return reportStr(YourReportName);
}
Don't forget to add main() method if you going to make call from menuItem.
I'm using DX 15.1, and I'm trying to create a new tab from a child form.
So, basically, I have a parent form called "pForm", and a child form called "cForm".
I'm using DocumentManager module and switched it to TabbedView mode.
When I'm trying to create a new tab from pForm, it's totally fine.
the problem is, when I'm can't create a new tab from cForm into pForm's TabbedView.
How do I achieve this?
Thanks, mate :)
UPDATE :
#DmitryG, thanks for your response.
I've attached a screenshot below.
The MDI-Parent is the RGP page with a settings header. and the MDI-Child is the Class Attendance form (popped-up window, triggered by a button inside the RGP form).
Can you give a solution, how to make the Class Attendance Form (mdi-child) became a new Tab beside RGP tab when it's triggered by a button within mdi-parent? Not as a popped-up window.
thanks!
When the DocumentManager works in MDI Mode you can just work with mdi parent and child forms. So, I believe, you code for adding a new mdi-child into mdi-parent form can looks like this:
static void AddMdiChildFromMdiParent(Form mdiParent) {
Form child = new Form();
child.MdiParent = mdiParent;
child.Show();
}
Within the mdi-parent form you can call this code like this:
AddMdiChildFromMdiParent(this);
To add a new mdi-child from an existing mdi-child you can reuse the code above as follows:
static void AddMdiChildFromMdiChild(Form child) {
AddMdiChildFromMdiParent(child.MdiParent);
}
I am trying to add a edit method to my grid from my data source in the form. I have the following code for the edit method:
edit boolean markLine(
boolean set,
Datasource _datasource,
boolean _mark
)
{
if (set)
{
if (!_mark)
{
if (selectedLines.exists(_datasource.RecId))
{
selectedLines.remove(_datasource.RecId);
}
}
else
{
selectedLines.insert(_datasource.RecId,_datasource.recVersion);
}
}
return selectedLines.exists(_datasource.RecId);
}
I then drag that into a grid which has the datasource specified in it and contains other fields from that datasource. Yet, when I try to use it in the grid, it is not possible to check the box.
I am using a view for my data source, not a table. I am not sure if this is the reason for it or if there is something else that is the problem. Any idea what the problem could be here?
Thanks in advance.
Edit
AllowEdit on the data source is true.
Ok, I checked around some more and found the following in the AX documentation about views
Views are read-only. The data fields and tables that a view uses cannot be updated from that view.
Therefore, edit methods will not work because views cannot be edited in the first place.
Edit
A workaround for this is to override the mouseDblClick method in the grid. Add the following code lines after the super():
Datasource_ds.selectedLines(true, Datasource, !selectedLines.exists(Datasource.RecId));
Datasource_ds.refresh();
Then when the user double clicks a method, it is selected.
I have some form with fiels, combos etc. I would like to go over through all the widgets on the form and if for example it's textfield, clear it, something like that:
foreach(QObject *child, this->ui->children())
{
QLineEdit *txtField = qobject_cast<QLineEdit *>(child);
if (txtField)
{
txtField->clear();
}
}
The problem is the ui object doesn't have such property like children and I don't know how to get the whole collection of children widgets.
Maybe the form object has something like Clear method. It would be the best.
Thanks
Try it.
foreach(QLineEdit *widget, this->findChildren<QLineEdit*>()) {
widget->clear();
}
How many QLineEdits are we talking about? Unless there's a good reason I would just add a method to the class that has ui as a member and do it by hand, like this:
void clearform()
{
this->ui->firstlineedit->clear();
this->ui->secondlineedit->clear();
...
this->ui->nthlineedit->clear();
}
A good reason why you can't do it this way is that the QLineEdits are dynamically added and you don't have them as members. In that case you can call QObject::children on the widget that is the parent of all your QLineEdits, if they share some common name, QObject::findChildren will also work.