Which plugin is used to show the data in front end of socrata - asp.net-mvc-4

Is it possible to implement the view(the table) that socrata gives to users to implement in a mvc application? Especially the scroll effect where it takes only ms to load data.
If not can anyone suggest any lightweight grid for same (scroll with faster loading)

The scroll effect is making use of paging by loading data dynamically, rather than trying to load the entire dataset at once.
If you are using SODA.NET, the Resource object has a GetRows(limit, offset) method that you can use to retrieve paged sets of rows in the dataset.
There are any number of ways you could implement the scroll-to-load, including client-side AJAX requests. See this answer to a related question for a starting point.

Related

How to re-use expensive data in a WSGI app?

I built a WSGI page that contains both tabulated data and a scatterplot of the same data from a database. (I'm using flask and matplotlib but that doesn't matter). This generates two separate requests: One for the HTML page and one for the dynamically generated image called from the tag. Since the database is rather slow and since both requests need exactly the same data I'd like to make this work with just one SQL query. Two approaches come to mind:
After querying the DB in the HTML view function, generate the scatterplot and save that in a PNG file somewhere. Then pass the tabulated data on to the template and serve up the cached PNG once the browser requests the image.
Somehow embed the image data in the HTML itself and have the browser render it using Javascript.
Approach 1. is simple and straightforward, but I also need a way to get rid of the cached images when they are not needed any more. This is prone to get messy. Since the app is purely http-request driven I would have to scan my cache dir on each request and decide which file is old enough to be deleted. Alternatively I could have an "onload" javascript function call my app a third time to trigger deletion of the image. Maybe clever, but robust?
I have no idea how to do this, let alone in a browser-compatible way.
Any suggestions?
I've been on Usenet for 25 years and still posting a question is the best method to find the answer yourself after a few minutes:
<img src="data:image/png;base64, {{imgdata}}">
and in the view function:
return flask.render_template('chart_page.html', imgdata=base64.b64encode(pixbuf))
End of story. No javascript.

Whats the best way to refresh the interface after I add a item data to database?

How to refresh the interface after you add a strip of data to the backend database in Vue.js?
I mean, if I add a item data to the database. there are two case for refresh the interface.
refresh the list api to get the page data.
append the added item data to local list.
what is the best way to do this?
I think both the solutions are valid it depends on what kind of write operation we are planning to do. Given that you do all the validations on the front-end which leaves lesser chance for errors on the backend. I do the following based on the use case.
Add/Update the item locally and then based on the response from the server I remove it again in case of an error. This is an optimistic technique used by a lot of websites and worls really well for CRUD kind of operations.
Let's say that your new operating is going to creaate a new user in a 3rd party api. So doing an optimistic thing might not be the best. So what I do is make the request, show a toast/alert that the request is happening, and then use sockets or long polling to get the changes. When the request is finally done show the data. In the meanwhile you can insert a dummy item showing loading.

Using CakePHP to build applications that deal with large data-sets?

I am using Datatables JQuery plugin 1.9 with CakePHP 2.4.
My application is an online Database interface. The database is not relatively huge. We have only 26,000 records. However, I found out that even with recursive = -1, and the use of "Containable" behavior, CakePHP is still limited to find 5000 rows only, before I get a memory exhausted error, and it even takes 5 minutes to load, in the view!
Of course, using the LIMIT option was just experimental as I need to list/paginate/search through the entire database records.
My question is, have anyone built a CakePHP application that dealt with similar number of rows or larger?? How did you do it? Any detailed documentation reference about your approach would be greatly appreciated.
I've been looking for a week for setting up the server-side processing of Datatables in CakePHP and none of the solutions/plugins suggested out there worked (e.g. cnizzdotcom's). Increasing the memory limit (up to 1 GB!) didn't help much too.
Unfortunately, if this limitation continues this will be our last time using CakePHP. But for now, it's very critical to find a solution of the problem.
you really need to display your 26k items at once on your datatables??
I'd change it and use an ajax pagination. You could still keep your datatables pagination and make an async request to cakephp (cake should return a json), in this request you'll need to pass the limit and the page (you could also pass the sort and direction) as parameters
Search the datatable's doc for ajax sources
create a view for this ajax
in this view create paginate your items using the "page", "limit", "sort" and "direction" parameters passed to the view (via GET probablly)
this view should return a json in a format that datatables could understand
But if you really need to display the 26k at once.. then ignore this answer.
Hope this helps

Search Option in Catalyst Framework

I have developed a web page for a database using catalyst and template toolkit. I have a table in my webpage. I want to have a search option in the same web page, which fetches data dynamically from the back end(database) and allows the user to search in the database.
I have jQuery datatables in my page, but it doesnot fetch the data from the database instead it will search in the table and give the result. As I am a new user to perl and catalyst, I request to tell me how can I have a search option in my webpage.
If my question is not clear,I would explain in detail.
What you're asking is not trivial to achieve, but can be done.
You need to first have a good read of the documentation on DataTables regarding server-side processing, and then rewrite the Catalyst Controller in your app that generates your data so that it mirrors the behaviour of Allan's PHP code: applying filters, sorts and limits, then returning JSON results. If you're using DBIx::Class and/or SQL::Abstract modules, it should be possible to create the equivalent functionality in far less code.
It's not for the faint-hearted, though. I've written and manage an application that uses Catalyst, TT and DT to render CRUD screens and I'm still not rushing to do a conversion to server-side processing until it proves absolutely necessary. (YAGNI principle + time-poor life.)

How can I dynamically get pages of data with AJAX using jQuery DataTable?

I have a Rails 3 application that uses jQuery DataTable to display a list of products that a user has drilled down to. However, in the case of a generic type of product, there may be over 3,000 different products to show. It takes about 30 seconds to render the page for such result sets, even though there are only 25 visible in the datatable (I understand that they ALL render, then datatable pages through the results).
My question is, I would like to only render the first page worth of results, and only call the others if the user clicks the next or previous buttons. Is that even possible?
All the processing i.e. pagination, sorting, etc. can be done serverside with this plugin. This example from the plugin docs shows how to handle the server side using php (sorry, I know you are using Rails) but it might give you an idea. They key is to set
"bServerSide": true
in the initialization of your datatable. Once you do that, you should be able to do whatever you like on the server side, instead of returning the entire dataset in one shot.
Note: Correct me if I am wrong but I assume you are using DataTables.
Much better than doing this server side is to set bDeferRender to true. This does just what it sounds like and only renders the rows it is displaying. We found that every browser later than IE6 has a good enough JS engine to handle many thousands of rows with that option enabled.