I wanted to see if anybody on here has encountered this yet...I'm looking to work with multiple ComboBoxes to Filter data in a Gallery. Currently, I have a search bar (TextInput1.Text) working in conjunction with multiple ComboBoxes (ComboBox1 and ComboBox3) -- which is attached to the Gallery > Items Function :
Gallery> Items = Filter('Table A',
((TextInput1.Text in 'Description') ||
(TextInput1.Text in 'Name - Long') ||
(TextInput1.Text in 'Tags')) &&
('Target Type'.Value exactin ComboBox1.SelectedItems.Result &&
'Target Level'.Value exactin ComboBox3.SelectedItems.Result)
)
PROBLEM
The issue with the ('Target Type'.Value exactin ComboBox1.SelectedItems.Result && 'Target Level'.Value exactin ComboBox3.SelectedItems.Result), part in the function above is that when you apply the && operator in between ComboBox1 and ComboBox2 , none of the data populates on the Gallery unless items are selected on BOTH ComboBoxes. Similarly, when using the || operator it only responds to the MOST RECENTLY selected items in the boxes.
POSSIBLE SOLUTION
In order for multiple ComboBoxes to execute cross-reference functionality(which is essentially what I'm trying to do with multiple boxes), I have to use an IF function that follows the following logic:
IF(more than 1 comboBox is being selected, apply && logic in between ComboBoxes[like shown above], else apply ||)
or
IF( just 1 combobox is being used, apply || logic, else apply &&)
Am I going about this the right way? If so, how would a function look in its entirety when incorporating this?
Related
I have got a Vaadin Combobox (Vaadin 8) to which I add two items. I would like that ComboBox to propose all views to which the user is supposed to navigate by a Vaadin NativeButton as described in the code snippet. In spite of the fact that "ContactView" is proposed below the ComboBox as soon as I type a "C", I cannot select "ResourceView" - and yet I have added it to theComboBox. What did I get wrong so that there is no correct dropdown?
navigatorCombobox = new ComboBox<String>("Navigate to...");
navigatorCombobox.setItems(Arrays.asList("ContactView", "ResourceView"));
navigatorButton = new NativeButton("go");
navigatorButton.addClickListener(
event -> {
if(StringUtils.isNotEmpty(navigatorCombobox.getValue()) && navigatorCombobox.getValue().equals("ContactView")) {
getUI().getNavigator().navigateTo(MynavigatorUI.CONTACTVIEW);
} else if (StringUtils.isNotEmpty(navigatorCombobox.getValue()) && navigatorCombobox.getValue().equals("ResourceView")) {
getUI().getNavigator().navigateTo(MynavigatorUI.RESOURCEVIEW);
}
});
This is intended behavior. Once you type "C" in the field, ComboBox will limit selectable options to those starting with "C".
I have created a custom type with multiple fields.
1 field is a checkbox to "show for all people"
2nd field is a textfield ( you can add multiple textfields ) for adding a code.
I created a view where all those content types are being shown in a page. ( this works )
But now:
When a person enters the site, he has to insert a code. This code is saved into a cookie because it needs to be remembered for about 2 weeks.
So I can't use the contextual filters.
If the checkbox "show for all people" is checked, this block is shown.
if the checkbox "show for all people" is unchecked, this block is hidden, except for people who came in without a code, or if the code is one of the values that was inserted in the 2nd field.
I don't wan't to use views php_filter. But I have no clue how to proceed with this problem.
I tried some solutions on the web to create a custom filter, but the problem here is, that we can't access the form values.
I found a solution, but I'm not sure if this is the correct drupal way.
I used the hook_node_view function to get all nodes that are printed on that page. I check if the code that was inserted into a cookie with the codes that are allowed ( created in the text fields of the content type )
function code_node_view($node, $view_mode, $langcode) {
if ($node->type == 'winning_codes') {
$code = _code_read_cookie('code');
$winning_codes = (!empty($node->field_winning_codes['und'])) ? $node->field_winning_codes['und'] : array();
$winning_codes = array_map(function ($ar) {
return $ar['value'];
}, $winning_codes);
if (!empty($code) && (!in_array($code, $winning_codes))) {
hide($node->content);
}
}
}
In Redmine's calendar, I would like to show all Tasks/Issues on which a currently logged in person in the account is a Member, Task Creator, Assignee, Reporter, or Watcher.
Now, from the following two arrays of helper.rb, I have created another array which merges issues_only and tasks_only. Then I wish to call that array in view part.
def issues_only
issues_all = issuesreportedbyme_items
issues_all.push *issueswatched_items
issues_all.push *issuesassignedtome_items
all = issues_all.reject{|v| v.tracker_id == 4}
rest = all.reject {|k| k.status_id == 5 }
rest.inject([]) { |result,h| result << h unless result.include?(h); result }
end
def tasks_only
tasks_all = issuesreportedbyme_items
tasks_all.push *issueswatched_items
tasks_all.push *issuesassignedtome_items
all = tasks_all.reject{|v|v.tracker_id == 5}
rest = all.reject {|k| k.status_id == 5 }
rest.inject([]) { |result,h| result << h unless result.include?(h); result }
end
Now, my question is what to include in view part in order to show the required calendar.
As you can see on this image the Calendar tab has filter options same as all other lists in Redmine. First you click on the filter switch icon (the little triangle on the image) and then you can add your filters to a report, list, gantt chart etc by selecting the filters from the filter selection combo box.
Your main problem will be that this filters don't have any logical operator feature. All the filters you select will be connected with the 'AND' operator so you can't define a list, gantt or report which corresponds to your 'OR' operator.
To get all the activities of all members of a specific project you only have to select the project and then unselect the "is : open" filter on the project calendar and click on "Apply Settings".
PS : This image is taken from our customized Redmine installation which has the Easyredmine plugin but the basics of filters are the same with Redmine.
Edit:
A way achieving your 'OR' requirement would be just selecting the filters which don't belong to your requirements and applying those filters. This way you would exclude those specific criteria that you want to apply the 'OR' statement to.
Don't forget to select the appropriate status filter in your filters. (Status is open/close/any/is not/is)
I'm working with an ExtJS 4 propertygrid that can list three different kinds of items that display when clicked on in another grid. One kind of item has to have a particular field hidden, so that it is't shown but any updates caused by editing other fields aren't affected by potentially missing information.
Attempts of using hidden/isHidden/visible/isVisible, with quoted and unquoted true/false values, haven't worked, and show the ShapeLength field in the propertyGrid.
Is there a "hidden: true" setting within the sourceConfig that I can apply somehow?
Example code:
var lengthDisplayName = '';
if(record.data.Type_ID == 'Circle(s)'){
lengthDisplayName = 'Radius (mm)';
}
if(record.data.Type_ID == 'Triangle(s)'){
lengthDisplayName = 'Side Length (mm)';
}
detailsGrid.sourceConfig['ShapeLength'] = {displayName: lengthDisplayName, type: 'number'};
if(record.data.Item_No == '-1'){
detailsGrid.sourceConfig['ShapeLength'] = {
displayName: lengthDisplayName,
type: 'number'
//, hidden/isVisible/visible value set here
}
};
No there is no hidden property for sourceConfig. But one possibility is to remove the property from the sourceConfig and reinsert it if it should be visible again.
delete detailsGrid.sourceConfig['ShapeLength'];
Was directed to an answer by a colleague - I can getRowClass within the propertyGrid and apply a hidden style on source data for an identifying property and the row name to hide, or else return out:
detailsGrid.getView().getRowClass = function(row) {
if(detailsGrid.source['Item_No'] == '-1' && row.data.name == 'ShapeLength')
return 'x-hidden';
return;
};
Using Doctrine in symfony 1.4 I have several boolean columns defined (stored as a tinyint in mySQL). The checkbox widgets are always rendering as checked, even when the returned value is '0'. It seems related to this ticket.
Is this a common problem? Is there a workaround?
I can get it working by changing line 70 in sfWidgetFormInputCheckbox to:
if (null !== $value && $value !== false && $value !== 0)
but I'd rather not alter core symfony files.
Another hack to resolve this bug without changing the Symfony classes is to set the default value for the field in the database to 0 (unchecked):
chk_field: { type: boolean, default: 0 }
And in set the widget in the Form.class as follows:
$this->setDefault('chk_field', $this->getOption('default'));
This should display the 'chk_field' field as 'unchecked' in your form
Symfony unresolved bug, see http://www.devexp.eu/2009/04/23/sfwidgetforminputcheckbox-unchecked-bug/
Your database returns a 0 for a unchecked box but Symfony renders it as checked.
You can patch yourself by editing symfony/lib/widget/sfwidgetforminputcheckbox.class, line 70 (in version 1.4.6), change:
if (null !== $value && $value !== false)
in
if (null !== $value && $value !== false && $value != 0)
Not sure in what context you're seeing the problem. I can get the following to work fine:
$database_field = '1;0;1;0;1;0;1';
$checked = explode(';', $database_field);
$this->form->getWidget('a_set_of_checkboxes')->setDefault($checked);
... the checkboxes with 1's get checked, 0's not.
I'm using "sfWidgetFormChoice" widgets with the attributes "multiple: true" and "expanded: true" so they're not individual checkbox widgets, but rather a single widget that contains an array of checkboxes/values.