i am using extJs paging tool bar with store or grid panel ,it works fine with records .
when if there are no records in database,and after receive jsson data.it does,nt display proper number of records which will be zero .please give me solution
You must have the total number of rows calculated in the controller part, to have a result as this one:
{success:true,"total":1,"result":[{"id":"2","MyColumn1":"blabla","MyColumn2":"blibli"}]}
Where total is number of rows
Can you give us your code and the json result that it's given to your store
Related
As I'm using angular ui-grid, I'm looking for a way to get sum of rows.
Basically I have a timesheet model grid where users will clock their work logs. The last column will show the total number of hours worked per week. This will be the sum of row items. How do we do this?
All examples lead to column aggregates but now row.
Thanks
You can always add a column at last, specify a template for the cell, and inside the template you will have access to row.entity, write a function that takes the row as input, traverses it for all 'keys' and sums them up, returns the summation. Call the function from the template, so in each angular 'tick' you will get updated values.
I am using ag-grid to display data. There are two tabs for current data and archived data. Above the grid for both tabs, in the title bar, there is a filter that filters the free text. The label of that filter shows the filtered rows/total number of rows.
In the archived tab, there is an additional filter that selects the data from past months. The filtered row count gets bigger than the actual number of rows when you quickly switch to:
Last Year
Last 6 Months
Last 3 Months
and then switch between tabs.
I think it is the in memory row model that is causing this issue.
I tried these two to get filtered rows
this.selectedRows = this.gridOptions.api.getModel().getRowCount();
this.selectedRows = this.gridOptions.api.getModel().rootNode.childrenAfterFilter.length;
I was just wondering is there any other way of doing it without using the in memory row model. Any help would be greatly appreciated.
Thanks a lot.
For future reference:
The code below is fine.
this.selectedRows = this.gridOptions.api.getModel().getRowCount();
The were some timing issues and I fixed this with resetting the row data by
this.gridOptions.api.setRowData([]);
this.gridOptions.api.setRowData(data);
I am using smart-table plugin for pagination.
My requirement is- i am fetching 100 records from database while loading and records per page is 10.
So, number of pages would be 10 in pagination.
Now, i want when i click on the page number 10 (from pagination) then i want to fetch the another 100 records from database & then those new 100 records will append in the table ( total records in table would be 200 and page number would be 1 to 20 in the pagination) and same for when i click on page number 20, another 100 records fetch from database and so on.
What I understood from your question is that you want the table rows to stack on one another instead of being replaced when you navigate on the paginator.
First of all, you don't need to use the default pagination, you can put your own custom markup in the <tfoot> tags
Second, if you want to show different amounts of rows on click, you could use the limitTo filter on the ng-repeat
Here's a plunk showing how I've added buttons that change the amount of rows being displayed on the table. you can use this logic (and functions) on your own template, just fetch the page number you going for, multiply by 10, and set that number as the amount you want to see
I'm using jqGrid with AngularJS to make a small web.
I have created a grid with some data, using jqGrid grouping including a summary row.
I've changed summary row position to the main row of each group.
I want some summary cells that have to be averages rounded to 2 decimals, but I don't get it working.
This is the colModel definition for one of the rows which I want to round:
{name:'cost', label:'Total Cost', width:55, summaryType:'avg',summaryRound:2, summaryRoundType:'round'}
How can I get that column rounded?
You forgot to add formatter:'number' in the colModel...
Please, take more time to do some research before asking next time.
I'm sure there is something out there about this topic but I just can't figure out how to word a search for it.
I have a table of records that gets loaded into a paging grid in the UI. The user has the ability to update/modify these records..also multiple users can use the system at once all hitting the same data. I have a filter on the paging grid allowing the user to see only X type of records.
When the user first enters with filter X selected they see items 1-25 on page 1 of 2. They page to the second page where the items should be 26-50..but before they paged lets say 25 records on the first page had their type changed by another user, now they don't appear when selecting that filter. So now we have 25 less items to page through which means items that were 26-50 before are now items 1-25 and what was page 2 is now page 1 and there is no page 2...
You can probably see the issue I'm getting into, I'm passing an offset to the query to get the next page of results..but now that offset is so high it returns a blank page of records confusing the user and our record processing.
There isn't really an easy solution to this problem. Even GMail/Google doesn't show the exact number of messages/pages found when searching something.
The first thing you can do (if you use a DataGrid/CellTable) is set the boolean exact as false when you call updateRowCount, and give it your current number of records instead of your total number of records. This will make the pager display "1 - 25 of over 25" instead of "1 - 25 of 50".
The next possibility is to update the row count regularly (using RPC polling to check for new/deleted records - or using server push techniques, see GWTEventService and ServerPushFAQ).
You can also check if your request returns items or not, and cancel the call/update the row count if it doesn't.