How to delete empty rows from Grid in my Form? - forms

I use to fill my StringEdit a simple displayMethod.
This method selected to see some records from myTable and discard others , this method work well, but, in my Grid I see the empty records-rows(that would be the record discarded).
For to fill my StringEdit I used this dispaly method :
display myEXDTypeString nameFIeld()
{
MYTable mineTable;
myEXDTypeString name;
while select mineTable
where this.FieldtoUse== "Value"
name = this.NameFIeld;
return name;
}
There's a way to delete the empty rows?
In my Grid
I have a Lesf site state , I want to have the right situation:
Thanks all!
Enjoy

If you are just trying to get the Form to not display blank records then it could be as easy as setting a QueryBuildRange on the data source:
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
super();
queryBuildDataSource = this.query().dataSourceName(mineTable_ds.name());
queryBuildRange = queryBuildDataSource.addRange(fieldNum(MineTable, FieldToUse));
queryBuildRange.value('>0');

I solved my problem: the cause is the Form DataSource relation.
OuterJoin Split my Lines.
Thanks all, enjoy!

Related

Ag-Grid QuickFilter changing programmatically searched columns

I need a quick search filter, where user can select what columns are searched. I didn't succeed to implement this behavior.
I tried this:
this.columns.forEach(column=>{
if (this.globalSearchSelectedColumns.indexOf(column.field)>-1) column.getQuickFilterText = (params)=> params.value.name;
else column.getQuickFilterText = ()=> '';
});
this.grid.api.setColumnDefs(this.columns);
this.grid.api.onFilterChanged();
this.grid.api.resetQuickFilter();
where this.columns is columns defs, this.grid is gridOptions, this.globalSearchSelectedColumns is the selected columns to search for, by column.field.
In order to selectively apply quickFilter form ag-Grid you should rewrite the property getQuickFilterText of the columnDef, by setting it to a function which returns an empty string like so:
First of all, you need to retrieve the column by a key through the gridColumnApi
Then you need to access its colDef
Lastly, all you left to do is to rewrite getQuickFilterText property
Assume, that in your class component you have a method disableFilterCol it can look something like this:
disableFilterCol = () => {
var col = this.gridColumnApi.getColumn("athlete");
var colDef = col.getColDef();
colDef.getQuickFilterText = () => "";
console.log("disable Athlete");
};
Once it called, quickFilter will be applied to your data grid excluding athlete column.
I created live demo for you on ReactJS.
You can improve the way you can select multiple columns that you want to rely on doing filtering.
I suppose that in your case you can try to add set getQuickFilterText = () => "" for either definition of colDef from the very beginning and let the user enabling particular columns, you can set getQuickFilterText property for them to undefined to provide sorting among them.
According to nakhodkiin solution I change my code like this:
this.grid.columnApi.getAllColumns().forEach(column=>{
let def = column.getColDef();
if (this.globalSearchSelectedColumns.indexOf(def.field)>-1) def.getQuickFilterText = undefined;
else def.getQuickFilterText = ()=> '';
});
this.grid.api.onFilterChanged();
And it's working;
I think the problem here lies in setting updated column defs.
Can you try this -
let newColDef= [];
this.columns.forEach(column=>{
if (this.globalSearchSelectedColumns.indexOf(column.field)>-1)
column.getQuickFilterText = (params)=> params.value.name;
else column.getQuickFilterText = ()=> '';
newColDef.push(column);
});
this.grid.api.setColumnDefs(newColDef);
this.grid.api.onFilterChanged();
this.grid.api.resetQuickFilter();
this.grid.api.refreshHeader();
Ag-grid updated its approach of detecting column changes since v19.1
More details here
As per doc -->
When new columns are set, the grid will compare with current columns and work out which > columns are old (to be removed), new (new
columns created) or kept (columns that remain will keep their state
including position, filter and sort).
Comparison of column definitions is done on 1) object reference comparison and 2)
column ID eg colDef.colId. If either the object
reference matches, or the column ID matches, then the grid treats the
columns as the same column.
Ag-grid team is also actively working on fixing this issue for v20.1. You can track it on github

select the value from ul-li dropdown in protractor

elementi want to select a 3rd value from the drop down of 6 options and the code snippet for a single option as below: the div class is under the li class.
RELV-Indirect Tax
RELV-Indirect Tax
i dont want to select by id instead i want to pass the value as "RELV-Indirect Tax". how to do the same?
Try the following code and let me know.
Clicking on the dropdown will work for you I guess.
var selectdropdown = element(by.xpath("//select[#id='TaxProcessMod']"));
selectdropdown.click();
selectdropdown.all(by.xpath("//option[#class='ng-scope ng-binding']")).get(1).click();
OR
selectdropdown.all(by.className("ng-scope ng-binding")).get(1).click();

How to add another DataSource in prompt Query?

I want to add another data source in Query prompt.
When I launch a form I open the prompt Query.
In my form init method I have:
QueryRun queryRun;
super();
queryRun = new QueryRun(TableA_ds.query());
if (! queryRun.prompt())
{
element.close();
}
TableA_ds.query(queryRun.query());
In my Form data source, in init method, I have put this code to set my query range:
tableA_ds.query().dataSourceTable(tablenum(TableA)).addRange(fieldnum(TableA,FieldtableA)).value(SysQuery::valueUnlimited() );
I want to add another data source (another table) - TableB.
I used this code:
purchLine_ds.query().dataSourceTable(tablenum(TableB)).addRange(fieldnum(TableB,FieldtableB)).value(SysQuery::valueUnlimited() );
But when I launch a Form I view only record query range from TableA
Relation of TableA to TableB is on field PurchId.
I want to see two ranges. Can someone help me?
Thanks for your time.
Enjoy!
I think you can add another datasource with:
purchLine_ds.query().dataSourcetable(TableA).addDatasource(tablenum(TableB);
purchLine_ds.query().dataSourcetable(TableB).relations(true)
Thanks Alex , for your Help,
I used this code,
in my Form init Method :
query q = new Query();
QueryBuildDataSource qbds, qbds2;
QueryRun queryRun;
qbds = Q.addDataSource(tableNum(TableA));
qbds.addRange(fieldnum(TableA,Field1TableA)).value(SysQuery::valueUnlimited());
qbds2 = qbds.addDataSource(tableNum(TableB));
qbds2.relations(true);
and launch the query ,
work well,
enjoy!

Programatic CellTable sort in GWT not working

I'm using the ListDataProvider example here as a guide. The columns are sorting fine as expectd based on the provided comparators. I'm trying to programatically apply a sort as alluded to on this line from the example:
// We know that the data is sorted alphabetically by default.
table.getColumnSortList().push(nameColumn);
What this does, is it makes the cell column appear to be sorted with the carrot sort indicator. However, the underlying data isn't sorted. Is there a way to get the table to actually apply the sort progarmatically. I suppose I could use this in conjunction with actually sorting the data via Collections.sort(), but I'd like to avoid that and do it in one place.
You can apply sorting on a column programatically with little exta code. The following code snippet does that -
When ever u set data to the cellTable you have to initialize the ListHandler as below code does -
cellTable.addColumnSortHandler( createColumnSortHandler() );
private ListHandler<T> createColumnSortHandler()
{
final ListHandler<T> listHandler = new ListHandler<T>(listDataProvider.getList());
listHandler.setComparator( sortColumn, comparator );
return listHandler;
}
And when u want to fire the SortEvent execute the following code snippet -
ColumnSortInfo columnSortInfo = new ColumnSortInfo( sortColumn, sortDirection );
cellTable.getColumnSortList().push( columnSortInfo );
ColumnSortEvent.fire( cellTable, cellTable.getColumnSortList());
you have to call setData on grid again.....

Remove all columns from a CellTable

I'm using a CellTable from GWT 2.1.0.M3. There are removeColumn functions, but no removeAllColumns or anything. Since "columns" is a private member of CellTable, not even my extension of CellTable can easily access it.
For now, I'm just storing the number of columns I add so I can remember to remove them all. Anyone know a better way?
I am using this way
Take count of columns of table
int count = this.getView().getTbcell().getColumnCount();
Loop through and remove first column
for(int i=0;i<count;i++){
this.getView().getTbcell().removeColumn(0);
}
Thats it we are done :-)
while (cellTable.getColumnCount() > 0) {
cellTable.removeColumn(0);
}
This might not be what your looking for but it works for me:
getCellTable().setVisibleRange(0, 0);
listViewAdapter.updateRowData(0, result);
getCellTable().setVisibleRange(0, 10);