Stephen Wrote:I tried your bookmarket, only 4 is correct, 1-3 are not right, I need it is sorted by quantities, what can I do?Zhengrong Zang Wrote:In fact, I hope that I can resort parts list on web page, if I click on title quantity, the parts list will be resorted by quantity from high to low, is this possible?
As I previously stated, LDView doesn't currently provide for sorting by anything other than the part number. But I've got a number of scripts lying around that do various things with an LDView Parts List html file, one of which is a javascript bookmarklet that provides for the ability to re-sort the parts list on demand.
This is just a quick and dirty hack - don't expect it to be perfect. I've mainly tested it with slightly older versions of Firefox/Chrome/Opera, and it should work on most browsers, except probably Internet Explorer (which I don't use).
To set it up:
Visit http://pastebin.com/m0e9yGxM
(I can't post the script here because this forum damages the script (even using "quote" or "code")).
Carefully copy the entire contents of the RAW Paste Data box to your clipboard.
Create a new bookmark in your browser.
Edit the properties of the bookmark.
Paste the copied script from above into the location/URL box.
Set the name to something useful, like "LDView Parts List Sorter".
Save the bookmark.
To use it:
Open an LDView parts list html file in the browser.
Click on the bookmark, and enter a number from 1 to 4 or -1 to -4 to re-sort the parts list.
It should re-sort using the selected field as the sort index. You can only use a field if you had LDView output that column to the parts list in the first place. You might also be able to use dual-index sorting. If you sort by color then again by description, you get a different result to sorting by quantity then description because it is sorting the result of the previous sort - but that may not entirely work as expected across all browsers. Hitting Reload will return to the original LDView generated sort order.
You should be able to print or screenshot your altered parts list. Unfortunately, you probably won't be able to use File/SavePageAs to save the re-sorted playlist because that will just save another copy of the original (but if you have Chris Pederick's Web Developer add-on installed then you can use its View Generated Source followed by a Save to save the newly sorted parts list).
Let me know if you try it, if it works, or if you have problems (mention which browser you use and what went wrong). It certainly works for me with LDView 4.1 parts lists.
By the way, I tested it on Safari.