Ng-repeat freeze with pagination - pagination

I am using ng-repeat to create html table ,in some case I have huge data like 11k rows ,but I am ok with using pagination . SO I am displaying only 25rows per page. But in my case broswer still freezes when I get the response from backend. I am using something like this
<tbody ng:repeat="airport in (filteredList = (orderList(list)) | startFrom: ((currentPage-1)*pageSize) | limitTo:pageSize)">
This is a plunker linkhere. Here it seems to be working fine ,my problem is it freezes when it started rendering table rows, even though it only has to render 25 rows (ie per page records) even all my watchers are set for current page records only . Am I missing something here. Inter page navigation is fine though.

Related

How do I scroll down to the end of web page using webdriver js and Node js

driver.executeScript("window.scrollTo(0, document.body.scrollHeight);"))
I have tried the above code but it returns window is not defined.
Data keeps on loading as I scroll down the page until the search data ends.
Try having a very large number instead of the scrollHeight attribute.
Something like this
browser.executeScript('window.scrollTo(0,10000);');

Can I render all zones to an HTML string in a controller method

I'm trying to render the HTML for a content item to a string from within a controller action. Technically I just want to get the "body" part of it without any header/footer stuff. I want to do this so I can get a content item rendering the way I want once, and then display it as a normal orchard page OR by requesting the HTML for the content item via ajax to display it in a div in a JavaScript app. I don't want to have to manually render everything in the JavaScript as that would be duplicating the layout logic I already did. I want to re-use the bulk of the server side rendering so any changes are reflected in my normal orchard page and my JavaScript page. I've been digging into the code and searching everywhere and have gotten close but not all the way there.
I found these:
How to render shape to string?
Using FindView in Orchard
In my controller I have:
var shape = _contentManager.BuildDisplay(contentItem);
Using either of the two methods above, I can render that shape to an HTML string in my controller. All was golden. I was getting the body of that page and using it in JS. Then, I changed a placement file:
<Place Parts_Common_Body="Content:1" />
was changed to:
<Place Parts_Common_Body="/AsideFirst:1" />
The body moved where I wanted it (AsideFirst) in my normal Orchard page but disappeared from the HTML retrieved using the two methods above.
If I look at shape.Content.Items after the BuildDisplay call, I can see the item for the body is no longer there... why is it not rendering all the zones? Or, I guess a more specific question is why is the BuildDisplay method not building the complete shape? Is there a way I can make this work?
I tried a million different things and eventually got this working. Not sure I totally get it yet, but I think the problem had to do with the fact that I was using shape.Content and I'd moved stuff out of the Content zone. And maybe when I was looking at what the BuildDisplay method was returning I was just not looking at some newly created zone that actually did had the stuff I thought was missing. Clearly I need to learn more about zones and shapes... Anyway, I have a new zone called "MainInfo" now that I created in a placement file. I get a MainInfo property on the main shape returned form BuildDisplay and pass shape.MainInfo to the view rendering code and all seems to be working well now.

Select2 multi-value: How to refresh

I'm using ajax in Rails 4 to load this form. Using select2-rails gem, it renders properly when the document loads:
After I click update, it loads the view partial:
but when I click on edit, the styling doesn't show up, and only the default bootstrap styling shows up:
How do I get this last image to show the select2 styling from the first image? I think it has to do with how select2 styling is loaded when the document is first loaded, but would appreciate a solution. Here is my stylesheet below:
$(document).ready(function(){
$("#e9").select2();
})
Allen:
Hello again by the way...
I had a similar problem in rails 4 and it had to do with turbolinks.
link: http://guides.rubyonrails.org/working_with_javascript_in_rails.html#how-turbolinks-works
In your JS file change your document ready to the function name below, then add the two commands just below the function, which are also below. This may be your issue as well because your page initially loads correctly, however when turbolinks is working, it tries to load only previously loaded files to quicken the load process and may skip your document ready function. Let me know if this helps... (Jake - DBC).
var select2Gem = function(){
$("#e9").select2();
};
$(document).ready(select2Gem);
$(document).on('page:load', select2Gem);

Livecycle - Pagination - Top of page

I got a problem.
I would like to have a repeating subform on the first bodypage("Sida1" bould one), that should repeat on the first masterpage(Page1). I want it to start at the top of the first master page all the time. But if I set it that way I think it might work, it gives me a white blank page at start and then work as intended(it start repeating subforms in the top of the masterpage (Page1)).
Seems like it will create one extra masterpage of the one you set it to, if you set it to be Top of page "Page1". It will create on master page to much. Atleast if you have those setting of the body page that is the first bodypage.
I don't have 10 reputaion to upload a images, so i will mark up how the hierarchy looks like:
Form
(Master Pages)
Page1
Page2
Page3
//Body pages comes below this..
-Sida1
-Sida2
-Sida3
-(Variables)

Strange pagination 404 issue with custom post type

I have a really strange problem trying to paginate custom posts types in their archives page, I created a custom post type called property and set an archive page called properties to show them all.
So inside my archive-property.php file added a form (GET method) with a dropdown box so users are able to set how many posts they want to display per page, it looks like this:
<select name="prop_number" id="prop_number">
<option value="12">12</option>
<option value="25">25</option>
<option value="50">50</option>
</select>
So before everything I do:
if (isset($_GET)) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$query_args = array(
'post_type' => 'property',
'paged' => $paged,
'posts_per_page' => 12 // Default number of properties per page
);
// Custom number properties per page
if (isset($_GET['prop_number']) && !empty($_GET['prop_number'])) {
$query_args['posts_per_page'] = $_GET['prop_number'];
}
}
query_posts($query_args);
// Do loop and other stuff
It works fine but when I use next_posts_link() to get to the second page I get a page not found 404 error, however if I go to my WP admin area and set the "Blog pages show at most" option to the same number I want per page in my select box (for example I manually set 25 on "Blog pages show at most" and select 25 in my prop_number select box) it does work fine.
I even tried using the WP-PageNavi plugin and it does render the correct amount of numbers depending on how many properties I want to show but I have the same problem 404 pages on any page I try to go unless I manually set the page in the backend.
If I didn't need the option to choose how many properties I want to show I'd just set the number manually but since users can choose between 3 options I can't set this to a fixed number in the backend.
Could anyone tell me what's wrong? Thanks in advance!
I'm not sure if you ever resolved your issue, but for the sake of anyone finding this question you may want to try flushing your permalink structure.
From http://codex.wordpress.org/Rewrite_API/flush_rules:
//Ensure the $wp_rewrite global is loaded
global $wp_rewrite;
//Call flush_rules() as a method of the $wp_rewrite object
$wp_rewrite->flush_rules();
Put that in your functions.php file, refresh your page, and see if that fixes your problem. It has for me in the past when I've had pagination 404 issues.
NOTE: once you have flushed your permalinks, remember to erase those two lines (see above) as you do not need or want that running every time a page is requested - it only needs to be done once. (This entire action may or may not be the same as going to the Permalinks page in your admin console.)

Resources