OpenJS-Grid icon indicating copy to clipboard operation
OpenJS-Grid copied to clipboard

Initial sort order

Open MGA555 opened this issue 10 years ago • 6 comments

In one of your videos, you show how to set up an initial sort order for a column by adding some properties following loadgrid(). Perhaps I got started on the wrong foot, put I could not find where you listed the javascript for a basic page, so I used the code in the index.html demo page. However, there is no loadgrid() there, so I am at a loss at to how to proceed.

More globally, I have looked all over for a OpenJS Grid "cheat sheet"; does one exist?

thanks

MGA555 avatar Apr 23 '15 01:04 MGA555

The "cheat sheet" is at the bottom of http://square-bracket.com/openjs. Make the browser wider and you'll see everything. sort and orderBy are missing. Thanks for bringing that up.

In this version 2.0 it's not loadGrid it's just .grid() now. You define an initial sort order passing orderBy and sort. The values for orderBy are a column name and the values for sort are "desc" or "asc"

optikalefx avatar Apr 23 '15 13:04 optikalefx

Are you referring to the API documentation? If so, that is a little too concise for me to consider it a cheat sheet. What people with my skill levels need are comprehensive examples of the code. It was only by trial and error that I figured out how to implement 2 joins.

I did get the single column sort to work. How do you implement multi-column sorts? I tried using an array with Order By and Sort, and I tried 2 pairs of Order By and Sort, but neither of those worked.

I assume there is a way? thanks

MGA555 avatar Apr 23 '15 16:04 MGA555

Yea I could add a join example, that could help. There isn't a way to add a multi-column sort. It's not so hard from the SQL side, but you'd need some UI to show that. I hadn't needed it so far, you can submit this as a feature request if you'd like.

optikalefx avatar Apr 23 '15 16:04 optikalefx

If you consider this the place for a feature request, then consider it made. I use multicolumn sorts all the time, and consider it a significant feature. If you want me to make it elsewhere, please let me know. In terms of my needs, "Add a Row". "Export", and "Multicolumn sort" in that order are my feature requests. Thanks!

MGA555 avatar Apr 23 '15 17:04 MGA555

BTW, could the multicoulmn sort be defined, just as the second and third joins ore, by the use of an array?

MGA555 avatar Apr 23 '15 17:04 MGA555

Yea that's how it would work, but i'd have to change the JS to support Arrays

optikalefx avatar Apr 23 '15 18:04 optikalefx