I have been working with jqgrid and like it a lot. I am currently wondering if there is a specific way to handle adding records to the grid when doing pagination on the server side. So here is how I think it should work:
1) Enter new record on client side using the grid add feature
2) Send new record to server (without displaying it)
3) Server determines where the new record is to be inserted in the pagination set on the correct page (since the data is sorted the new record needs to be inserted in the pagination model that may not currently be displayed)
4) Returns the new set of records (page) to be displayed that contains the new record
5) Preselect the new record in the set
6) Make sure the selected record is seen in the viewable area of the grid
I have tried searching for exactly what I am looking for but have not had much luck. I'm hoping someone here can help shed some light on what I am trying to do. Thanks!
Reload the grid and try
function reloadGrid(txtJSON)
{
jQuery("#list").jqGrid('setGridParam', {postData:{searchDetails:txtJSON}});
jQuery("#list").trigger("reloadGrid");
}
Related
I have no issue to use DataTable, to filter its data and put it into a DefaultView.
The thing is even I use original DataTable or creation of DefaultView to present the filtered data my time dependent operation is getting constantly input that is refreshed in DataTable that is bind to DataGridView and when the filter is active and values are updated row-wise it is refreshed. So it results in this specific visual thing that rows that are filtered out get inserted back but not completely just in 1 column and if I select this row in DataGridView it pushes out an error System.IndexOutoFRangeException.
If no filter is active all is fine.
I need an advise what I need to do to reach my goal:
Even if a filter is active the values should be updated in DataTable (works already) that refreshes DataGridView without a "glitch"glitched so I can select a row without getting the aboves exception.
Solved:
The trick looks simple that solves the glitch too.
myDT = new DataTable();
myDV = new DataView(myDT);
bind the View to DataGridView.
I've implemented a Kendo grid with basic CRUD functionality (JS front end, MVC controller) and this all works correctly. I have a requirement to provide functionality that enables a "replace all" type function. For example, I filter by a company name then click edit on a record and change the email address or phone number - I also need the option to update all records in the current filtered set to the edited email/phone number. (instead of editing each record individually).
Is there anything in the tool set enabling this type of functionality or will I need to build a custom control?
Many thanks!
I found a solution from a previous question, an example is here:
http://jsbin.com/alocoj/1/edit
Also if you require the filtered and sorted data set (instead of the entire set) use:
var grid = $('#grid').data('kendoGrid');
var dataSource = grid.dataSource;
var data = dataSource.view();
The .view() gets the current set
I want to know where and how does magneto store the data to maintain grid filter and mode type. Like I go to listing page and select list mode while displaying five records and then goes to other page of the same site and comeback. It shows me my previous grid mode and records. I display $_REQUEST, but doesn't see anything there. Anyone knows how I can get those values?
Magento store limit,order,direction in Mage::getSingleton('catalog/session').
If limit,order,direction is found in REQUEST then new value is set in Mage::getSingleton('catalog/session') .
You can check getLimit(),getCurrentMode(),getCurrentOrder(),getCurrentDirection() function in the class
app\code\core\Mage\Catalog\Block\Product\List\Toolbar.php
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
I seem to be havign yet another problem with jqGrid :-( I am trying to get the current row data using getRowData, but all I get back is an array [object, Object]. What am I doing wrong?
This is what I'm using
var rowdata = $("#list").jqGrid('getRowData');
Can somebody help?
thanks
After reading in the comments additional information about your problem I would recommend you following.
If you need to print the page which contains jqGrid you could need to prepare additional CSS for media="print". See here for additional information.
The method getRowData called without parameters give back the array of rows which are array of visible cells. For every cell will be called unformatter, so the data could be not identical to to data which you posted to jqGrid. Moreover if you use data paging or filtering you can have another problem: only visible cells from the current page will be returned back.
I personally prefer to use export to Excel instead of printing the pages. In the case I add an custom button in the navigator bar. If the button will be clicked by the user the request to the corresponding MVC controller action will be sent. The server get all data for the corresponding grid from the database and generate XLSX Excel data as stream with respect of Open XML SDK. The corresponding code is not very small, but in the way one can generate perfect Excel file formatted like it is required. In the case you don't need install Microsoft Office on the server side. The user just opens Excel with all data if he/she clicks the "Export to Excel" button in the jqGrid. In Excel there are very good printing possibility. The most users knows Excel very good and can customize the data (hide some columns for example) before printing.
So my suggestion to you to spend some time in implementing export to Excel instead of implementing printing of jqGrid directly.