I'm using the pagination custom build from here
I don't know how to make the pagination buttons work with my data. Do I have to filter it somehow?
This is where I display my data:
<div class="col-xs-12 col-md-4 content appear" ng-repeat="post in filterPosts | filter:searchPost | orderBy: sorting.orderBy:sorting.direction | filter : filterPost track by post.id">
After that, This is where the pagination part is:
<div ng-controller="PaginationController" class="col-xs-12" style="height: 50px;">
<pagination class="pagination" style="right: 10px; position: absolute; margin: 0px;" total-items="total_items" ng-model="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination></div>
There is a plunker example for the pagination part, but there's no data involved. Here is the link
Yes, you need to filter your data. The pagination directive just gives you a way to present to the user the list of possible pages and lets the user easily control the current page. You need to use the page size (defaults to 10) and the current page value to filter the data and display the correct page.
One way to do this is to add an additional filter to help with skipping:
app.filter('offset', function() {
return function(input, start) {
return input.slice(start);
};
})
and then use this with limitTo to control the paging
<div class="col-xs-12 col-md-4 content appear"
ng-repeat="post in filterPosts | filter:searchPost
| orderBy: sorting.orderBy:sorting.direction
| filter : filterPost track by post.id
| offset: (bigCurrentPage - 1) * 10
| limitTo: 10">
Example JSFiddle here
Related
I am using asp.net core with bootstrap datatable. It has one pagination for 1 datatable. I want one one more pagination , how can i add it.
DataTables has some built-in controls:
l - length/page size dropdown
f - filter / search input
t - the table itself
i - table information, show xxx of total entries
p - pagination control
So you can always change the DataTables markup to add/remove any control you want in the dom option: https://datatables.net/reference/option/dom
For example, you can add an extra pagination on top of the current filter box in Bootstrap 4 like the following:
$(function() {
$('#example').DataTable( {
"dom": "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>"
+ "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>"
+ "<'row'<'col-sm-12'tr>>"
+ "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
...
} );
});
A line <'col-sm-12 col-md-7'p> basically reads as following:
<!-- < means a div -->
<!-- ` means the class assigned to the div -->
<div class="col-sm-12 col-md-7">
<!-- the pagination control -->
</div>
Update 2: A The following repo on github shows the problem.
Update 1: Calling #firstNode in Template.editor.rendered returns <div class="editor"></div>.
I have the following template:
<template name="editor">
<div class="editor">
{{#each objects}}
<div class="object">{{content}}</div>
{{/each}}
</div>
</template>
The data is provided by iron-router in the data callback.
The coffeescript for my template:
Template.editor.rendered = ->
#findAll('.object').draggable()
When I go into my browser and try to drag one of the objects I get the text selection cursor and begin to select the text with the div instead of the object being dragged. So what is wrong and how can I get the drag and drop to work?
The drag and drop functionality is being provided by jquery-ui. Which is installed as a smart package.
Also feel free to edit the title of this post as I had a tough time coming up with one that made sense
The solution I found was to abstract <div class="object">{{content}}</div> into a seperate template like so:
<template name="object">
<div class="object">{{content}}</div>
</template>
Then change
Template.editor.rendered = ->
#findAll('.object').draggable()
to
Template.object.rendered = ->
#findAll('.object').draggable()
As stated in meteorpedia.
We are trying to display large amounts of data on a webpage.
Data is cached, and is loaded via angular (to allow the actual page to load first and then fetch the data for the grid)
All working ok, however once the data has been received, the page freezes for 1 - 3 seconds,
which we assume is due to the table being rendered.
Size of table can vary, and range from 20 columns 10 rows to 100 columns 100 rows.
All data has to be loaded, as it is to display trends etc.
Below is the table:-
<table id="tbl" class="table table-striped table-bordered" ng-repeat="Grid in userresults.Trend">
<tr ng-repeat="item in Grid" ng-show="$first">
<th ng-repeat="somat in item | filter:{ColumnType :'!1'}">
{{somat.ColumnHeader}}
</th>
</tr>
<tr ng-repeat="item in Grid">
<td ng-repeat="somat in item | filter:{ColumnType : '!1'}" >
{{somat.ColumnValue}}
</td>
</tr>
</table>
Below is the angular:-
$scope.GetPatientResults = function () {
$("#ResultsLoader").show();
var url = "/user/11111/GetUserResults/";
$http.get(url)
.success(function (data) {
// if successful, bind success message to message
$scope.userresults = data;
$("#ResultsLoader").hide();
$('#ResultsSummary').show();
});
};
is there a way to actually only build part of the table that is displayed on screen to avoid this 1 - 3 second rendering / some kind of lazy loading for tables for rows and columns?
Any help / advise is greatly appreciated as this is currently impacting usability on our system.
One alternative may be to try to use ngGrid instead of a table. I believe that ngGrid will only render the items seen on screen, and not all grid items at once. If your problem is indeed the browser rendering, this approach should help.
The problem might be the <table> rendering type of the browsers.
All browsers render tables when all the columns and rows complete, so your data delay the rendering. There is an option to make the appropriate changes in order to render everything in div or try the following link which says that speeds up the table layout.
<div id="tbl" style="float:left;" ng-repeat="Grid in userresults.Trend">
<div style="float:left;" ng-repeat="item in Grid" ng-show="$first">
<div style="float:left;width:200px;" ng-repeat="somat in item | filter:{ColumnType :'!1'}">
{{somat.ColumnHeader}}
</div>
</div>
<div style="float:left;" ng-repeat="item in Grid">
<div style="float:left;width:200px;" ng-repeat="somat in item | filter:{ColumnType : '!1'}">
{{somat.ColumnValue}}
</div>
</div>
</div>
i have a Wierd action here, i am using Meteor 0.7 (latest version), and i want to create a layout for my application where i have a menu on the left and content on the right, and i want it to be resizable, so i used Jquery UI and created teh following code.
<template name="layout">
{{> header }}
<div class="container">
<div class="report-tree">
{{> report_tree }}
</div>
<div class="content">
{{{ yield }}}
</div>
</div>
</template>
also i created this function on Meteor Client,
Template.report_tree.rendered = function (){
console.log("report_tree is rendered")
$("li.parent_li i").attr('class','glyphicon glyphicon-plus-sign');
$("li.parent_li ul li").hide();
$(".report-tree").resizable({
handles : 'e',
minWidth: '50',
maxWidth: '350',
resize: function (){
$(".content").width($(this).parent().width() - $(this).width() - 30)
}
});
$("#datepicker").datepicker();
}
the functionality is okay and reveything works fine, however when just click on an link inside my app, i can see that
console.log("report_tree is rendered")
is rendered & the date pickers is working fine, but the resizable function is not called and the div is not aboe to resize, if i clicked on teh refresh button then everything is working back again.
i dont know why this is happening and whether i need to hook my script on a different event or what ?
I am using the new v3 of the Google Maps API. Basically the issue I have is that I have a Google Map within jQuery UI Tabs. The map is not in the first tab, so you have to click the tab to view the map, but it does not always render correctly. I.e. sometimes the map images are not correctly placed.
I had this problem when I was using v2 of the API, but I managed to resolve the problem by initializing my Map like this:
map = new GMap2(document.getElementById("map"),{size:new GSize(500,340)});
Unfortunately that doesn't work in v3. I had a look at the suggestions in this thread: Problems with Google Maps API v3 + jQuery UI Tabs
Nothing really worked for me, but I used one of the workarounds in that I initialize the map function on tab load:
$(function()
{
$("#tabs-container").tabs({show: function(event, ui)
{
if(ui.panel.id == "viewmap")
{
mapiInitialize();
}
}});
});
This is all good but I much rather prefer for the map to be "there" when the user clicks on the tab. It sometimes takes a few seconds for the map to load up and all the user see's in that time is a plain gray background - some sort of loading indicator might have helped.
So does anybody have any suggestions? My markup and CSS is as follows:
<div id="tabs-container">
<ul>
<li><span>Details</span></li>
<li><span>Location Map</span></li>
<li><span>Reviews (<?php echo $numrows; ?>)</span></li>
</ul>
<div id="details"><?php echo $details; ?></div>
<div id="viewmap" style="padding: 10px; border: 1px solid #A9A9A9;">
<div id="map" style="height: 340px;"></div>
</div>
<div id="reviews"><?php echo $reviews; ?></div>
</div><!-- end tab-container -->
Try this when you are initializing your jQuery UI tabs:
$("#tabs-container").tabs({
show: function(event, ui) {
google.maps.event.trigger(map, 'resize');
}
});
Note: You will have to initialize the map before you initialize the tabs.
Once you switch to the tab that has the map call google.maps.events.trigger(map, 'resize'); that should then make it display correctly.
just use
map.setZoom( map.getZoom() );