Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am new to rails, most of my experience is with desktop (Windows) GUI.
In Windows it is possible to bind s a listview to a database table.
the GUI component hold a only the visible rows of the large table.
if the user scroll up/down to rows not in view, the control do a "behind the
scenes" query in database to get the new rows to be displayed.
That allows the GUI to map arbitrary large tables with constance memory usage.
I am sure there must be a similar technique for rails, most likely with the aid of
JQuery but I failed to find it.
I assume the terminology is different is the web world
I would recommend a combination of the will_paginate gem, AJAX, and some javascript framework (jQuery, prototype, AngularJS, etc.). You can use will_paginate to render the first page, and then as the user scrolls down, monitor the scroll progress and load more records. Here's a link to get you started.
I ended up using select2 which did exactly what I was going for
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I wrote a ruby script that finds a solution to the Bays29 travelling salesman problem. The bays29 data set is found here:
http://elib.zib.de/pub/mp-testdata/tsp/tsplib/tsp/bays29.tsp
Now say my solution is in an array that says go to city 1, then 4, then 9 etc..
I want to show this visually being solved somehow. For e.g. I would like to have it in a browser showing all the cities connected together and then the solution gets highlighted after it is generated.
How can I go about doing this?
What kind of gems should I use?
Thanks a lot!
You could write a small Rails app with the algorithm in a model and some javascript (with either OpenLayers or Leaflet) for map visualization.
The traveling salesman is a hard problem, so it might take a while to calculate a result. You could use AJAX or Server Side Events to update the map when the server has found a better soluton.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have an app that is already fully built, the only thing I'd like to add is real-time rendering of one of my pages.
Suppose it is a page with all the pizzas. When pizza is added to the database, I'd like page to show it without refreshing.
I know you can do it with websockets, but is there any easier way? Could, eg, AngularJS help here (as I understand it refreshes the page contents as soon as model is changed)?
Well you could make a small service in Angular that asks the server like every 15 secons or so, to see if there are new pizzas added to the database. (Say the last time you took the pizzas from the server you had 15 of them returned. Now you send that number 15 back with the check request and compare it with the database)
If so, it will call the query method in the pizza Angular service to fetch the new pizzas.
If this is a small table with often changing info then I would also suggest to migrate this model into Redis instead. Asking info repeteadly from Redis is a lot cheaper than it is to ask like this from a database.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My application is one page contract. I would like users to be able to sign the contract by clicking on a button. The contract is not a resource; it's plain HTML.
Every solution I have found so far relies on having a model that acts as votable. How can I implement a simple button that users may only click once, and display the number of users who have clicked it?
It's not possible to do this with static pages, at least not in a way that is clean and secure.
Think about it this way: every user is looking at a copy of the contract, which is being displayed to them on their browser (the client). If you want users to be able to cast votes that persist and be aware of votes cast by other users, then you need a server that keeps track of it centrally. That's why the solutions you have found so far rely on having a model, presumably backed with a table.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Google Translate. Bing Translate. You can add a widget. You can select "Spanish" and the page will translate to Spanish.
I do not want to user to have to select "Spanish". I want the page to load in Spanish automatically. Never mind why I want these things. They are necessary parameters.
You could start by looking at navigator.UserLanguage in javascript. It's not entirely foolproof, but it's a good starting point, and provided the users aren't messing with what the navigator object actually pulls (fairly easy to fake) it should give you a reasonably good start.....you don't really have what language(s) you're using on your page tagged, so it's sorta hard to provide specific help.
Reading the documentation might help http://msdn.microsoft.com/en-us/library/dn341982.aspx#feedback
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I usually use drop down lists in many scenarios, such as selecting predefined types, parent record, etc.
But currently I am working on a system where a drop down list might have more than 200 records . and I want users to see more info about each record to be able to choose. So drop downs might not be user-friendly and usable in my case.
So what are other components or packages I can use with asp.net mvc , something like displaying a dialog box which allow users to search , filter , view more details about the record before selecting it?
BR
I've used select2 in these scenarios before with good results. It allows you to see the whole list if you need to (just like a regular dropdown) and it also gives you a way to filter the list if you know what you're looking for.
Have you thought about using autocomplete; http://jqueryui.com/autocomplete/ this would solve the problem.