free-jqgrid / jqGrid

jQuery grid plugin
https://github.com/free-jqgrid/jqGrid
Other
478 stars 196 forks source link

Performance comparison with the paying version of jqGrid? #492

Open Mrodent opened 4 years ago

Mrodent commented 4 years ago

Hi, sorry if this is not the best place to ask this.

I'm trying to choose a JS data grid solution (to link to dbases via Ajax and server-side scripting). The choice seems to have boiled down to either your project or the DataTables project. I want it to be FOSS. I've started examining the JS source code of both these projects (to try to understand what's going on, and how easy it might be to add my own developments).

At the moment I'm inclining towards yours. There are lots of things to consider when trying to decide, but for example here, the consensus seems to be that the jqGrid solution is more configurable and probably has better performance.

However the link there is to the "Gurrido" (paying) version of jqGrid.

Do you have any views about whether your fork may have improved performance since the fork (v. 4.6.0 I believe), or whether the Gurrido version may have improved?

By the way, on this page you say that you'd be interested in native English speakers helping improve the documentation. I'm a native English speaker and when I get more familiar with the project I'd be happy to see if I could help with that.

pycr commented 4 years ago

Are you going to use it with PHP or Python?

Mrodent commented 4 years ago

Python. Will this make a difference to the answer to the question?

pycr commented 4 years ago

The reason is that I made an open-source datagrid in Python using free-jqGrid. https://github.com/pycr/pythongrid maybe it will help you to decide.

Let me know if you have any questions.

Mrodent commented 4 years ago

That looks interesting. At the moment I'm working things so that I don't need Flask or Django: just calls to the dbase using mysql.connector. I want to make my first tests of this as dependency-free and uncomplicated as possible.

But can I ask: you must have been using jqGrid-free for some times: did you weigh up the pros and cons between jqGrid-free and DataTables?

Also I'm puzzled about the status of jqGrid-Gurrido (the paying version): it is possible to download all this source code from its Github page. So what are people paying for? And why did this fork happen back in 2014? I mean, why did Oleg need to fork jqGrid-free when the Gurrido source code is available to download freely?

pycr commented 4 years ago

@OlegKi explained here after MIT license was dropped.

I am not entirely sure how you would use jqGrid without a web framework. You've mentioned mysql connector, but didn't go about how you would have data displayed on the front-end. Without a web framework, AFAIK even for things like obtaining URL query parameters can be frustrating. That is one of the reasons I chose to use a framework for pythongrid.

I'm still relatively a Python newbie. If you know how to get around and be efficient in developing web apps in Python without a framework, I'm all ears.

Mrodent commented 4 years ago

I'm not a Python expert either. My Python cgi file is currently very simple as it only does one thing: retrieve some rows from a data table. But any SQL statement could be processed by a bit of tweaking. (In practice people everywhere say always use prepared statements, with settable parameters...).

posted_json_string=sys.stdin.read()
POST = json.loads( posted_json_string )
table = POST[ 'table' ]
# this line needed because of an encoding problem with the Apache2 process:
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer)

print( "Content-type:application/json; charset=UTF-8\n" )

def myconverter(o):
    if isinstance(o, datetime.datetime):
        return o.__str__()
json_dump = None
try:
    conn = mysql.connector.connect( host='', database='test_kernel',
            user='root', password='root',   charset='utf8',  use_unicode=True  )

    if conn.is_connected():
        cursor = conn.cursor(dictionary=True)
        cursor.execute( f'SELECT * FROM {table} limit 10' )
        results = cursor.fetchall()
        json_dump = json.dumps( results, default = myconverter )
except Exception as e:
    print( f'exception type {type(e)} thrown: {e}')
    exit()
print( json_dump )
pycr commented 4 years ago

For a proof of concept, that what I initially did with MySQL first before I decided to use SQLAlchemy instead in order to support a wider array of databases and more streamlined API.

Like what you did, it does similar data retrieve before loading them onto jqGrid to render the grid. It wraps jqGrid in grid class so that one doesn't really need to know a lot about the jqGrid. Just take a look at the routes.py.

At a minimum, this is all you need

@app.route('/')
def index():
    grid = PythonGrid('SELECT * FROM orders', 'orderNumber', 'orders')
    return render_template('grid.html', title='demo', grid=grid)

@app.route('/data', methods=['GET', 'POST'])
def data():
    data = PythonGridDbData('SELECT * FROM orders')
    return data.getData()
Mrodent commented 4 years ago

As I say, that does look interesting, RESTful, etc. But it also involves learning something entirely new and understanding what's gone wrong when things don't work out. Bear in mind that I've only just discovered jqGrid today! The learning curve is a bit steep, not least because the intro documentation is cursory. I've just googled my way to a first vague grasp of how cell editing works.

To return to the subject of this thread, though, if you don't mind, have you ever looked at DataTables? A number of early indications (in my investigations) and opinions expressed out there and observations I've made today are tending to make me incline towards jqGrid. Did you consciously choose jqGrid over DataTables at some point and if so what swayed it for you?

pycr commented 4 years ago

I like jqGrid. It has less learning curve than DataTable, which I only used in another different project. Mind you, they are all front-end, so one must still develop server-side scripts to handle update and delete. In my view, jqGrid is much more flexible than DT, still very fast. My large dataset ever used is over 3 million rows.