Forums | Mahara Community
Limit on items per column in a Page
03 February 2015, 1:11 AM
We've had a handful of students experiencing issues with making pages because they've been trying to put a lot of items into one page column.
There seems to be a limit of 127 items per column, due to the data type of the 'order' column in the database for block instances. (tinyint)
I've put in a warning message for people who have reached the limit, but I would rather increase the limit. Any thoughts on just increasing the possible number of items, by changing the 'order' type to, e.g. smallint instead of tinyint ?
Students often bring a Tumblr kind of mentality to posting on a page. It would be good to support this approach - maybe also by adding an 'endless scroll' option, where page content is loaded when one scrolls to the bottom of the page...
12 February 2015, 1:14 PM
Sure, I'd be open to changing the data type for that column, to allow more blocks on the page.
I think some kind of tumblr-infinite-scroll-view would be a good idea. As you say, users expect it.
As it so happens, for 15.04 I just implemented a feature that loads up the block contents by AJAX, in order to improve page load times. Currently, it just loads up the outline of the whole page, then calls the Jquery ".load()" method to load the contents of each block. I haven't tested it with more than a few blocks so far, but if you've got pages with 128 blocks on them, I guess I should try that as well.
I'd like to add some additional polish to the AJAX block-loader... like a nice timeout/error handler that turns the spinner into an error icon with a reload button. But I haven't gotten to that yet.
Your use case suggests that it would also be good to make the AJAX block-loader maybe hold off on loading the block contents if they're scrolled way down off the visible part of the page.
12 February 2015, 3:04 PM
For the only loading visible blocks I'd imagine you'd want to get an array of all the block id's on page load then loop through them checking
1) am I already loaded?
2) am I in the viewport?
and if false for (1) and true for (2) load content
and have window scroll do the same check
To check the 'am I loaded' could be done by giving the unloaded blocks a class to check for and remove once data is loaded
19 February 2015, 11:45 PM
That sounds good.
No doubt there will be add-ons for jQuery out there which could be adapted. Using jQuery should simplify the viewport checking across browsers.
On the database side, I am trying to recall if there are any data integrity issues in simply changing a table column type to a larger one of the same type.
03 March 2015, 11:44 AM
Using the "change_field_precision()" method in lib/ddl.php should generate the appropriate SQL to change the column and its contents without any data loss.
Looking at the underlying code, it looks like in MySQL it's able to just alter the column directly, but in Postgres it has to create a temp column, populate it, and then do a cast() operation, which will potentially make this a lengthy upgrade for a site with many pages.
03 March 2015, 10:13 PM
Ah. that's useful to know. Thanks.