Syncfusion GroupingGrid always expanded - syncfusion

I´m working with a GroupingGrid of the Syncfusion. And I realized that the ExpandAllGroups() operation is consuming many resources, than I thought that maybe GroupingGrid have some parameter that lets all groups expanded by default.
Any help?

An alternative way to expand the Groups is by using IsExpanded property. This is a Boolean property which could be set to true in order to set the groups to an expanded state.
public void iterate(Group g)
{
foreach (Group gr in g.Groups)
{
gr.IsExpanded = true;
iterate(gr);
}
}
The above method can be called by using the following code in form():
this.iterate(this.gridGroupingControl1.Table.TopLevelGroup);
Kindly, check with the above code and see if it resolves your issue

Related

In Tritium, is there a way to assign an id based on child number?

I have a table with a series of rows. I want to change them into divs, but maintain (somehow) their positional information. At the moment, this is what I'm doing:
$("./tr[1]") {
add_class("mw_old_row_1")
}
$("./tr[2]") {
add_class("mw_old_row_2")
}
$("./tr") {
name("div")
}
But this isn't ideal because:
It's super-repetitive
I don't know how many rows there are
Is there a way to take the child number and include that in the class I'm assigning?
Yup, you want to make use of the index() function. Below is the example you wrote reworked using index():
$("./tr") {
add_class("mw_old_row_" + index())
name("div")
}
Below is a link with the following example in tritium tester: http://tester.tritium.io/775895b154e8e2ce99e100967299c10d73dbeb91

GXT add filter to store

I'm having problems with a relatively simple piece of code.
I'm trying to set a filter for my store items (store associated with a GridView).
gridStore.addFilter(new StoreFilter<IncidentDto>() {
#Override
public boolean select(Store<IncidentDto> store, IncidentDto parent, IncidentDto item) {
if (item.getDescription().equals("WEEEE-TEST")) {
return true;
} else {
return false;
}
}
});
The problem is the store doesn't filter at all.
Thanks to anyone who will take the time to help me out with this.
Don't forget to enable the filters - this exists so that you can make several filter modifications without actually asking them to act:
gridStore.setEnableFilters(true);
Sorting doesn't have this as there isn't a concept of turning sorting 'off' - items are sorted to have a new order, then they stay that order. In contrast, filters can be turned back off to restore the items that are no longer visible.
If you trace the code, you will notice that the filter is not called in onLoad(). You have to manually call filter();

Richfaces 4 dynamic select options when user type

I am using rich faces select component.
I want dynamic values when user manually type some thing in the select component.
<rich:select enableManualInput="true" defaultLabel="start typing for select" value="#{supplierSearchBean.userInput}">
<a4j:ajax event="keyup" execute="#this" listener="#{supplierSearchBean.userInputChange}"/>
<f:selectItems value="#{supplierSearchBean.selectOptions}" />
</rich:select>
Java code as follows
public void userInputChange(ActionEvent ae){
Map map = ae.getComponent().getAttributes();
System.out.println(map.toString());
}
public void setUserInput(String userInput) {
System.out.println("userINput = " + userInput);
this.userInput = userInput;
}
Here i found 2 issues
1st: setUserINput always print empty string when user type value
2nd: listener method never get call.
any help ?
The problem is most probably that there is no selected value while the user types, and this component restricts the allowed values to the specified select items. A partial input is thus not valid and cannot be bound to your bean.
I think you could get the expected behavior if you use a rich:autocomplete instead. However, if you want to restrict the allowed values, maybe you can keep your rich:select and listen for the selectitem event.
Override getItems function in richfaces-utils.js file in richfaces-core-impl-4.0.0.Final.jar under richfaces-core-impl-4.0.0.Final\META-INF\resources folder.
Change the condition of pushing items to be
if(p != -1)
instead of
if(p == 0)
This should fix the issue.

Finally Action on PostSharp Exception aspect

I got following situation
private volatile bool _inProgress = false;
public void DoSomethingStart()
{
if(_inProgress == false)
{
foo.BeginInvoke(null, null); // DoSomething
_inProgress = true;
}
}
[CatchAllExceptionsFromHere]
private void DoSomething()
{ }
The aspects works so far. All exceptions are handeled from CatchAllExceptionsFromHere. But i want to set "_inProgress = false" in the finally clause of the aspect - so if DoSomething has finished "_inProgress" should be set to false. Since Attributes cant take any object - is there a workaround?
Thanks michael
Aspects can take values on the declaration to set property values or just like a constructor. What you want is an OnMethodBoundaryAspect and in the OnExit method (which fires even if an error has occured, so it's just like a finally) you want to set the value of _inProgress.
However, the aspect needs to be an instance aspect and you'll need to either import the _inProgress member or just introduce it so that the aspect has access to it. It depends on if your class needs access to it. If it does the have the aspect import the member. Read up on how to do these things with these links
Aspect lifetime & scope part 1
Aspect lifetime & scope part 2
Introducing members part 1
Introducing members part 2

Zend Framework: is there a way to access the element name from within a custom validator?

I'm writing a custom validator that will validate against multiple other form element values. In my form, I call my custom validator like this:
$textFieldOne = new Zend_Form_Element_Text('textFieldOne');
$textFieldOne->setAllowEmpty(false)
->addValidator('OnlyOneHasValue', false, array(array('textFieldTwo', 'textFieldThree')));
My validator will check that only one of those three fields (textFieldOne, textFieldTwo, textFieldThree) has a value. I want to prevent a future developer from accidentally passing the same field twice.
$textFieldOne->addValidator('OnlyOneHasValue', false, array(array('textFieldOne', 'textFieldTwo', 'textFieldThree')));
So far, my validator works perfectly, except when I pass the same field name as the field that has the valiator set on it.
In my validator, you can see that I am checking that the value (of the element with the validator set on it). I'm also checking the values of the other fields that were passed to the validator.
public function isValid($value, $context = null) {
$this->_setValue($value);
$this->_context = $context;
if ($this->valueIsNotEmpty()) {
if ($this->numberOfFieldsWithAValue() == 0) {
return true;
}
$this->_error(self::MULTIPLE_VALUES);
return false;
}
if ($this->numberOfFieldsWithAValue() == 0) {
$this->_error(self::ALL_EMPTY);
return false;
}
if ($this->numberOfFieldsWithAValue() == 1) {
return true;
}
if ($this->numberOfFieldsWithAValue() > 1) {
$this->_error(self::MULTIPLE_VALUES);
return false;
}
}
private function valueIsNotEmpty() {
return Zend_Validate::is($this->_value, 'NotEmpty');
}
private function numberOfFieldsWithAValue() {
$fieldsWithValue = 0;
foreach ($this->_fieldsToMatch as $fieldName) {
if (isset($this->_context[$fieldName]) && Zend_Validate::is($this->_context[$fieldName], 'NotEmpty')) {
$fieldsWithValue++;
}
}
return $fieldsWithValue;
}
My solution is to either...
A. Let the developer figure out there is a certain way to do it.
B. Ignore $value, forcing you to pass all the elements (which isn't much different than the first option).
or C. (if possible) Find the name of the element that called my validator in the first place and ignore it from the list of $fieldsWithValue.
I don't think there is a way to apply a validator on a form without attaching it to an element, but that would be even better, if it were an option.
How can I solve this problem?
Normaly i'd advise against such things, but, in this case I believe a static member in your class would actually provide a good solution to this problem.
With a static member, you can set it to the value in the first time the isValid is called, and check against it in subsequent calls, thus giving you a mechanism for this.
You may want to set this up to use some array in the configuration options, so that you can namespace and allow multiple instances of the validator to exist happily alongside each other for different sets.
The only problem that you really have to decide how to overcome, is where you wish to display the error, as yes the form itself does not take validators. if you want all the duplicates after the first to display an error, it is not so much of a problem.