Using latest SmartClientJS 13 LGPL, I have a ListGrid that uses SC13's new "searchForm" property. We have had quite some debate about this in earlier posts but I would prefer to completely ignore that and say that I have the "searchForm" property working now. But not 100% correct for this particular example.
I have a ListGrid for products. In it, I have the "searchForm" property set to an instance of SearchForm. The search form contains two fields: a TextItem to enter free text and a ComboBoxItem to select a supplier. I also want to filter by one or more properties (things like diameter, length, application, etc.). I've managed to get this working and it looks like this:
The way I got this to work, is by creating the search form with "Search" and "Supplier" fields and (outside of the form) a MenuButton with items being DynamicForms with CheckBoxItems. Each checkbox has a changed() handler that submits the search form. If I do that, of course it doesn't include the properties so I thought to be smart and extend the search form's getValues() method and combine the properties with those values. That method looks like this:
The result of a call to searchForm's getValues() then becomes:
This more or less works, but I doubt if this is the correct way, because it triggers 2 equal requests. I found out that this happens because "properties" is an object. If I leave that out or pass it a value like null, it won't happen.
Is this intentional behavior? I need a way to avoid that extra request. Can I somehow integrate the properties inside the search form (not sure which component I would need).
Hope this is understandable.
P.S. I could have skipped the whole MenuButton explanation but I wanted to give some context about what problem I'm trying to fix.
I have a ListGrid for products. In it, I have the "searchForm" property set to an instance of SearchForm. The search form contains two fields: a TextItem to enter free text and a ComboBoxItem to select a supplier. I also want to filter by one or more properties (things like diameter, length, application, etc.). I've managed to get this working and it looks like this:
The way I got this to work, is by creating the search form with "Search" and "Supplier" fields and (outside of the form) a MenuButton with items being DynamicForms with CheckBoxItems. Each checkbox has a changed() handler that submits the search form. If I do that, of course it doesn't include the properties so I thought to be smart and extend the search form's getValues() method and combine the properties with those values. That method looks like this:
Code:
// inside SearchForm getValues: function () { // propertiesMenuButton.getValues() is custom made and returns something like { diameter: [19, 76] }. return isc.addProperties({ properties: propertiesMenuButton.getValues() }, this.Super('getValues'); }
Code:
{ properties: { diameter: [19, 76] }, search: null, supplier_id: null }
Is this intentional behavior? I need a way to avoid that extra request. Can I somehow integrate the properties inside the search form (not sure which component I would need).
Hope this is understandable.
P.S. I could have skipped the whole MenuButton explanation but I wanted to give some context about what problem I'm trying to fix.
Comment