Additional filtering parameters in #fuelux datagrid - fuelux

Does the fuelux datagrid support adding additional filter options? I would like - for instance - to add (next to the filter dropdown you already have in place), a checkbox which should also be added as a parameter to my function that retrieves the data remotely from the server.
It would be nice if the grid would automatically take any parameters from input elements that we can mark by adding a specific class or data- attribute.
Thanks very much! :)
David.

You can absolutely do this.
Add filtering logic to the datasource you provide, keyed off any custom property you add to the datasource.
Add the checkbox within the datagrid markup (or anywhere).
When your checkbox is clicked, update the custom property on your datasource and then call $('#MyGrid').datagrid('reload') to tell the datagrid to reread your datasource

Related

Reusable Custom Control with ComboBox: Add <selectItems> thru Property Definition

I am trying to set up a reusable custom control with a combobox to be used with Bootstrap. The custom control has already all the divs, styles etc. that are needed for Bootstrap.
Now, I added a Property Definition (type: string, Allow multiple instances), so that when you use the custom control on any form, you can add selectable values to the combobox:
As a values property for the combobox, I added a computed item with the following JavaScript:
compositeData.listValues
When I use the custom control I can add values individually, one instance for one selectable value and it does work great:
However, when I compute the value to, lets say, get a list of values from a keyword document or view column:
the combobox value list looks like this:
How can I pass on a list of values thru property definition to the combobox? Is it possible at all?
UPDATE: Is there a way to loop thru the instances of a property definition? That way I could check if the current instance is a single text value or an array, put a list of all the values together and return it as a value list.
Thank you very much for your help!
In the Custom Control properties, next to Type, leave it as String and then click on the folder icon. In there you can choose complex types.
In there you can choose view column, among a vast array of choices.
UPDATE: David Leedy pointed out a caveat in regards to using comma as a separator for #Implode/#Explode. This could cause issues, if any of your values contains a comma. So, I amended my answer to account for that:
First of all, I'd like to thank everyone who took a look at this question and / or responded to it.
I had an epiphany this morning and found a solution. Might not be very elegant but it works.
As we are going to use #Implode/#Explode to build the value list for the combobox, we need to add another property definition to the reusable custom control. This property will be used to pass on the information, how the computed value list will be separated:
When I add values to the custom properties, the computed value for getting the list of values from a keyword document should look like this:
var oView:NotesView = database.getView('$vwSYSLookupKeywords');
var oDocument:NotesDocument = oView.getDocumentByKey('.DBProfile', true);
#Implode(oDocument.getItemValue('iTxtTest'),';')
As you can see, in this example I use ";" to implode the list.
This is now my list of Custom Properties:
And this is the markup for the whole custom control where I use the reusable custom control:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xc:ccLegend
listSeparator=";">
<xc:this.listValues>
<xp:value>Test 1</xp:value>
<xp:value>Test 2</xp:value>
<xp:value>#{javascript:var oView:NotesView =
database.getView('$vwSYSLookupKeywords'); var
oDocument:NotesDocument = oView.getDocumentByKey('.DBProfile',
true); #Implode(oDocument.getItemValue('iTxtTest'),';')}</xp:value>
</xc:this.listValues>
</xc:ccLegend>
</xp:view>
If I now use the following in my computed value list for the combo box:
var sSeparator = compositeData.listSeparator;
#Explode(#Implode(compositeData.listValues, sSeparator), sSeparator);
the values are properly displayed in the combobox:
This does also work with #DBColumn and #DBLookup!
If you have a better solution, please do not hesitate to post it here.
Did you try to set the property to object instead of string. That should allow you pass an array to the custom control with imploding and exploding it.

Changing the properties of a field dynamically

In my application's viewport i'm showing the form panel with a list of fields in center region and property-grid in east region.
I need to show the list of properties of the field in the property-grid on selection of the field.
The user is able to change the properties.
Now my requirement is to apply the properties dynamically to the field.
Is there any generic way to achieve this?
Can someone help me?
Some properties have getter and setter functions, but not all of them and I doubt they are consistent enough for what you are trying to do.
My suggestion would be to store the config object for each field, the config object would have each property that you want to be able to change using your property grid. When a property changes, remove the field from the form. Re-create it using Ext.create and passing your config object as the second parameter. Then just insert the object back into the form.
EDIT: You can probably skip using Ext.create by using the insert function on your form panel, it seems to be able to accept a config object directly.

How to make an extjs grid a form field?

I have a requirement to create a custom form field that is basically an extjs grid. The user should be able to click a result in the grid. This clicked result should then become the fields value. Also, this field needs to extend Ext.form.field. Here's what I got:
Ext.define('MyApp.field.Grid', {
alias: 'widget.GriedField',
extend: 'Ext.form.field.Base',
I'm a lot of confused on how to add a grid to form field base. Looks like form field base's template expects HTML. How do I get it accept a component?
If you just need to select a value from a list of items. Why not use a combobox?
If you need to select multiple items. There is an example of how to use the MultiSelect ux component in the documentation examples.
http://docs.sencha.com/ext-js/4-1/#!/example/multiselect/multiselect-demo.html
If you really must use a grid. Then I wouldn't bother with trying to create a field type and cause yourself grief.
Add a listener to your grids selectionchange event and update a hidden field in your form with the value you want from the grid. Job done.
I ended up putting the grid on a form indirectly through creation of dependencies on my model.
My model has master-detail, which the detail is just a store reference. I found that using associations did not work for me.
So, in adding a field to a form, I have something that manages changed events for the model (master record) and the detail stores.

Change ADF Query Panel's Default Component

In my JSPX page, I created a search page by drag-n-dropping the View Criteria (VC) to the page. By default the component's are text box. What I want to do is change some of them to use other components, such as the selectOneChoice component, with binding from another Entity Object (EO), or maybe add a date picker to it.
Is this possible? Or do I have to stick with the defaults?
This is all stuff that can be done in your view object under Attributes. For date attributes, make sure that the type is set to date. I've'nt done this one but for the selectOneChoice component, I'm assuming you can define a list of values on the desired attribute that is based on another view object. Also look in the Control Type field of the Control Hints when you edit an attribute. If you are using bind variable with your search I believe you can define these properties there also.

Problems with checkboxes in Datagrids

I am having some trouble with CheckBoxes in a DataGrid. The CheckBoxes are not bound to the entities that are populating the datagrid because there isn't a property on the entities for it. Basically what I am trying to do is when I check a CheckBox I add the ID of the item in that row to a list to be returned. The problem I am having is when I check some CheckBoxes and the page with the DataPager it uncheckes the CheckBoxes on the first page and tries to remove them but the DataGrid has already gone to the second page so it throws a null reference exception because it can't find those items anymore. How can I fix this? If you need me to post my code just let me know.
One approach to this is to customise the partial class that Entity Framework has created for you. Add your boolean property to the entity class. Now you can bind the checkbox column as any other column ant the data will be maintianed between paging.
You can then just enumerate through the items currently in the context select those have been checked.

Resources