ExtJS 4.2 Change Group by this column - c#-4.0

By default my ExtJS 4.2 Grid is grouping correctly.I want to know the event that is called when we click Group By This Field in ExtJS 4.2.I want to get the column value on this grouping has to be done and save the column field in the database.

I'm not sure if I understand you correctly, but let's give it a shot.
The following event is fired when changing the grouping of a grid.
http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.data.Store-event-groupchange
store.on('groupchange', function (store, groupers) {
// group values available here
var values = store.groups.keys;
// name of the column currently grouped by
var columnField = groupers.keys[0];
// then do whatever you want with these values
});

Related

Tabulator update column position programmatically?

Is it possible to update column position with Tabulator?
Or is there a way to do it?
Apparently there is no function to do it.
A moveColumn function will be coming in the 4.2 release next week.
In the mean time you can easily change the order of columns in the table by calling the deleteColumn function and then the addColumn function.
//remove column
table.deleteColumn("age");
//add column elsewhere in the table after the name column
table.addColumn({title:"Age", field:"age"}, "name");
or by changing the column definition array and resubmitting it using the setColumns function
//define new column layout
var columns = [
{title:"Name", field:"name"},
{title:"Age", field:"age"},
{title:"Gender", field:"gender"},
]
//replace all columns
table.setColumns(columns);
Full documentation on these features can be found in the Columns Documentation

Different default sort directions for Columns in Table in React-virtualized

Using the Table and Column components of react-virtualized, I have achieved a default sort column and direction by defining a sortBy dataKey and the sortDirection in the Table component. I have another column, which I would like to have sort in descending order (instead of the default ascending order) the first time a users clicks it, but can't see how to do this. Is it possible to have a default sort direction per Column?
Update: I don't want to sort columns simultaneously, but instead want to have different sort directions for each column when sort is first implemented per column. For example, I want to start the defaults for my table to be sorted by lastname in ascending order. However, I have a few other columns that hold integers or booleans, and that I would like to sort in descending order when the user first clicks on those columns. In ascending order, those columns would first display false and 0's (if any), but would be more meaningful if they were first sorted with true or a set's upper numbers. I'm trying to slightly improve the user experience as to not have to click twice on the columns to get a descending order.
RV's Table does not support the concept of sorting by multiple columns simultaneously. (I'm not sure how it would make sense, unless 1 field is the primary sort and the other is a secondary sort?) Either way, I think that use-case is uncommon.
I think the easiest way to do what you're looking for would be for you to specify your own headerRenderer for the sorted-by Columns:
<Column
{...otherProps}
headerRenderer={yourHeaderRenderer}
/>
You could even decorate the default/built-in header renderer. Then instead of using the sort-by props from Table just pass your own to the sorted-by columns:
import {defaultTableHeaderRenderer} from 'react-virtualized';
function yourHeaderRenderer(props) {
return defaultTableHeaderRenderer({
...props,
sortBy: yourSortByHere,
sortDirection: yourSortDirectionHere
});
}
Update What you're actually asking for here (a default sort direction per column) is completely up to your application. Basically your sort function could look like this:
let prevSortBy;
const sort = ({ sortBy, sortDirection }) => {
if (sortBy !== prevSortBy) {
// You can decide the initial sort direction based on the data.
// Just ignore RV's best-guess default in your case.
}
prevSortBy = sortBy;
// Do your sort-logic here (eg dispatch a Redux action or whatever)
}

Searching controls dynamically by adding search properties in code

I am trying to identify controls at runtime by adding some search properties in my code as and when required. Using Coded UI in Visual Studio 2012.
Please refer to the screenshot below. My test scenario is:
1) Click on a particular tab (the 2nd tab selected in the screenshot)
The Tab list is fixed so I can create one control in My UIMap for each tab.
2) Inside every Tab, there is a tabular structure with some data. The Table headings are fixed but the number of rows and the data inside the rows is dynamic.
3) Check the checkBox for the required tag
4) Select Type for required tag
I have created my UIMap as:
Added following code:
UIEquipmentTagText.SearchProperties.Add(new PropertyExpression(WpfText.PropertyNames.Name, "1302"));// say I want second row
To fetch the respective checkbox control, I am using:
UITestControl UIEquipmentTagCell = UIEquipmentTagText.GetParent();//get the cell of Tag name
UITestControl UIEquipmentTagRow = UIEquipmentTagCell.GetParent();//get the row
UITestControl UIEquipmentCheckBoxCell = UIEquipmentTagRow.GetChildren()[0];//get the first cell i.e the checkbox cell
UITestControl UIEquipmentCheckBox = UIEquipmentCheckBoxCell.GetChildren()[0]; // get the checkbox control
But this is not working for me. I guess the UIRow control is referring to first row only (though I haven’t specified to look for 1st row)
I do not want to include row number in my search criteria for Row.
Is there any workaround to get all the controls I want based on the Tag Text only?
figured out a solution finally..get all rows and iterate to find the matching row
UITestControlCollection allRows = row.FindMatchingControls();
foreach (UITestControl x in allRows)
{
UITestControl Tag = x.GetChildren()[1].GetChildren()[0];//row->tag cell->tag text
if (Tag.GetProperty("Name").Equals("1302"))//say I want to select row having 1302 tag
{
UITestControl checkBox = Tag.GetParent().GetParent().GetChildren()[0].GetChildren()[0];//TagText->TagCell->Row->CheckBoxCell->Checkbox
Mouse.Click(checkBox);
}
}

Filtering view in lotus notes

good day,
I'm trying to filter date by year using #setviewinfo. can anyone tell me how?
Here is an example, put this formula on PostOpen event on view. It will filter all document by column with user name.
#SetViewInfo([SetViewFilter]; #UserName; "columnName"; 1; 1)
columnName - is a real name of column (you may set it in Column Property)
Remember to clean filter on QueryClose even on view, otherwise all view will use this filter.
example how u should remove filter
#SetTargetFrame("frameName");
#UpdateFormulaContext;
#Command([OpenView]; #Subset(#ViewTitle; -1));
#SetViewInfo([SetViewFilter]; ""; "columnName"; 1)
frameName is a frame that contains view, columnName is your categorized column. If you do not use frame - simply skip 1-st row

How do I get the contents of a selected row from a YUI datatable?

I'm trying to get the contents of a cell in a row in a YUI datatable.
I can use myDataTable.getSelectRows()[0] to get the first selected row. However, how do I get the contents of the first cell in that row?
It looks like getSelectRows() returns an array of record IDs. You can retrieve the corresponding record using getRecord(). Once you have a record, use getData() to retrieve the value of the field you are interested in.
var recordID = myDataTable.getSelectRows()[0],
record = myDataTable.getRecord(recordID);
console.log(record.getData("myField"));
http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getRecord
http://developer.yahoo.com/yui/docs/YAHOO.widget.Record.html#method_getData
I think I may have the answer for you assuming you have not already found it yourself.
I have the same kind of page with a datatable and a textarea field, when you select a row in the datatable calls the same page displays further detail from the selected row in the textarea field and retains selection of the selected row.
1: To do this I apply the following example MySQL query called AllMyBroadcasts...
SELECT #rownum :=#rownum + 1 RowNumber, p.*
FROM tblBroadcasts p, (SELECT #rownum := 0)r
ORDER BY Date DESC
the tblBroadcasts table has fields : Date, Narrative, ID
2: I then provide the following to the table row of my YUI Datatable within HTML hyperlink tags.
href="MyPage.php?SelectedBroadcastID=' .$row_Broadcasts['ID'].'&RowNumber=' .($row_Broadcasts['RowNumber'] -1 )
3: When the href is clicked MyPage reload with additional parameters SelectedBroadcastID and RowNumber the SelectedBroadcastID I use in a second query against tblBroadcasts called MySlectedBroadcast which a simple query on outputting all fields where the ID = SelectedbordcastID. I then to my field to display the narrative of my selected row in my textarea field.
The second paramater I do the following with.
$SelectedRowID = 0;
if( isset($_GET['RowNumber'])) {
$SelectedRowID = $_GET['RowNumber'];
}
Above I placed just after code covering my two queries.
4: Then finally to get the datatable to select the row of the selected row I include the following to the var yuidatdatable section of the datatable script...
yuidatatable1.select(yuidatatable1.getRow());
The -1 value referred to step 2 serves as a work around to fact that yuidatatable works on a 0 base and the MySQL referred to in step 1 on a 1 base.
There you go !
Perhaps there is a better why using get from within YUIDatatable scripting, be nice to know if so. That said this work fine for me and perhaps if you have not found an answer I hope this helps.

Resources