Rally JS SDK refresh listener - sorting

In case of a WSJF App, the app is not sorting columns correctly, it completely ignores the 0's and only sorts the positive non-zero numbers on clicking the column name. So I am trying to write my own sort using the "refresh" listener. My question is, how can the refresh listener know which column was clicked that triggered the listener?
The refresh listener is as follows:
refresh: function(this,eOpts){
//I need to check which column was clicked, (both this and eOpts) are returning objects but none has values that I can use.
}

Related

Extjs- Grid column headers refresh for every search

I am trying to sort my results grid based on a default column header every time the results gets displayed. I tried giving a sorter to the store and it worked fine when the page loads first time. Its working as I want it to be. But the problem arises only when I try to click on a different column header in the grid. When I click on a different header it sorts based on that particular column values. If I click on search button at this point of time without reloading the page, the search results get displayed and are sorted based on my previous selected column. I want this to be sorted based on the default column. Problem is the grid gets refreshed with search results every time I click on search or reset buttons but the column headers are not getting refreshed. So the results are getting sorted based on my previous selection. To fix this problem, I am trying to reload the whole page every time I click on search or reset. Is there a way that I can refresh the column headers along with the search results every time I click on the search so that the results get sorted based on the default column header. I am able to refresh the search results and the pagination part for every search but not the column headers. Any solution...
Thanks....
One thing you didn't mention is whether you really want to allow the user to sort by different columns.
You can switch this behaviour off in the columns definition using sortable: false
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.column.Column-cfg-sortable
If you want to keep that behaviour, you can replace the sorters with the default one again on every load:
var myDefaultSorter=Ext.create('Ext.util.Sorter',{
property:"MyProperty",
direction:"ASC"
});
store.on('beforeload',function(store) {
store.sorters.clear();
store.sorters.add(myDefaultSorter);
}
Have you tried store.sorters.clear() ?

How to imitate a Kendo grid's popup edition dialog?

When a grid's edition mode is set to "popup", it automatically generates a dialog box to let the user modify the editable fields of the selected row.
Using the grid's "update" method, the values are then persisted in the DB and if the PHP handler routine returns the newly updated row, the grid will magically display the properly modified values of the targeted row while keeping it selected !
MY NEED: I must do the exact same thing but with a self made edition dialog(kendoWindow).
I cannot use the one automatically generated by the grid. (For lots of very good reasons...)
Once closed, my self made edition dialog calls an AJAX routine that persists the data in the DB and returns the newly modified row.
How can i update the grid's dataSource with the PHP returned values and while keeping the targeted row selected ?
NOTE: The Grid's row can only be updated after the "update" call to the PHP server returns since some of the values are modified in the PHP code... values that are displayed in the grid.
I'm not sure if this will fit your needs, but you can change the popup editor by using the editable.template setting. That might let you customize the popup to do whatever else you need it to do.
To select a row you need to locate the <tr> element and pass it to .select() on the grid widget. If you happen to know the UID generated by the DataSource, then you can do:
var rowElement = $(gridWidget.element).find('tr[data-uid="' + uid + '"]');
gridWidget.select(rowElement);

Is there a way to force a single row refresh with SlickGrid?

I have the amazing SlickGrid configured to access data asynchronously and post user changes back to the server asynchronously. In general terms, the server may modify a few fields of a row based on the user's changes. As such, after the row is updated I would like SlickGrid to refresh only that row without changing the rest of the view.
Does anyone know how to do this?
In my case, the field that changes on the server is a timestamp associated with the record that is updated by a database trigger. If the timestamp is out of date, the user has an old copy of data, and if they submit changes, they may overwrite a new copy. Since I can't find a way to trigger a refresh, the user cannot modify their own changes without refreshing the browser window (forcing a complete refresh).
You should be able to do this using grid.invalidateRow() and grid.render(). SlickGrid will re-render the affceted rows (assuming they are displayed in the currently visible viewport) without refreshing the entire page.
// Mark row 42 as changed and re-render the display
grid.invalidateRow(42);
grid.render();
For an example check out SlickGrid Example 14. (Click the Start Simulation button to see it in action)
function updateSlickgrid() {
dataView.setItems(tableName);
grid.invalidate();
}
Note : tableName could be the array or id etc.
I prefer storing all the slickgrid data in the array ex tableName = [];
Keep using the above function when it comes to displaying the data in slickgrid

Fire "afteredit" after edit the entire row in ExtJS grid?

I have an ExtJS editor grid which has some columns inside. I want to modify data on a record and auto save data to DB. But I just need save data after I complete editing all cells at the current row. I've used the event "afteredit" but it fired the event right after one cell was changed.
How can I keep that event not to fire until I've completed modifying all cells? Or could you please suggest another way to do this, not use the "afteredit" event?
Thank you so much.
You might take a look at Ext.ux.grid.RowEditor. It has an afteredit event that fires when the row is done being edited.
You can find the working example at http://dev.sencha.com/deploy/dev/examples/grid/row-editor.html
Here is my question back: Do you edit all the cells in a row? A better solution would be to use a "save" button to send the updated data back to the server and save it into DB.
Now, if you insist that all cells at a row will be modified, you can do the following:
In afteredit event handler:
Get the record being edited (you can get it by event.record)
Check if all the fields have been modified in the record. This can be done by inspecting the public property modified.
If all the fields are modified, proceed with sending the updated record to server for saving into DB.
When edit event has been fired, you should check modified config to check whether all of grid columns have been modified or not. After modifying, you can send them to your back end.
I think in your case it would be easier to have a button that you click to save the grid. you could access all the modified records by calling grid.store.getModifiedRecords() and send that to your backend service and do a mass update instead of updating a single row at a time.
You could use the rowdeselect event on the selection model (assuming that you use a Ext.grid.RowSelectionModel. Inside the event handler you can check if the record has been modified and react accordingly.
var grid = // your grid
grid.getSelectionModel().on("rowdeselect", function(selModel, rowIndex, record) {
if (record.dirty) {
// record has been modified
}
});

how to send the selected row values from jqGrid to server?

I have a grid with multiselect option true...so when I multiselected the rows and click on the button say "Release"
it should send those rows to server ...Can any one point me towards right direction?
Inside of onSelectRow event handler (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events#list_of_events) you receive the array of ids of selected rows as a parameter. With respect of getRowData(ids[i]) (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods) you can get full data from the i-th selected row. Then you can construct the from all the data a data which you want to send to server and use jQuery.ajax to send the data to the server.

Resources