Currently, the additems table is rendered using the DB, which can cause performance issues for large amounts of items. It makes sense to switch to using the REST API (/api/v1/biblios/{biblionumber}/items)
Hi Sam, this seems like a huge work. Please share with us your plan before starting :)
(In reply to Jonathan Druart from comment #1) > Hi Sam, this seems like a huge work. Please share with us your plan before > starting :) Sure. Firstly, we need to remove all of the body code for building the table using a for loop in additem.tt and fixup the headers as well. Then in the cataloging_additem.js, we would need to build the table using kohaTable with '/api/v1/biblios/' + biblionumber + '/items?' as the ajax url. Then for the columns we can simply grab the responses from the api, and make necessary render or function changes for certain ones. For example, the actions button will need to have a custom data function to ensure the button functionality still works. Also, the home and holding libraries (among other things) need to be rendered as a string rather than the code. Also need to hide the columns that have no data upon loading. That's pretty much the big stuff
This table does handle column visibility a bit different than others - not sure it needs to stay that way, but worth looking into when tackling the project maybe.
I was wondering we could reuse what have been done on bug 33568.
(In reply to Jonathan Druart from comment #4) > I was wondering we could reuse what have been done on bug 33568. Yes, a lot of that is being reused.
Created attachment 170482 [details] [review] Bug 37637: Use the API to load the items table This patch removes the previous use of the database to load the additem table and instead uses the API. To test: 1) Test the current datatable behavior: visit an item's detail page and select 'Edit' then 'Edit items' 2) Apply the patches, restart_all, reset_all, clear caches, etc. 3) Again, test the table behaviors. Try adding items, using the actions, filtering and sorting the items, etc.
Created attachment 170483 [details] [review] Bug 37637: Hide the timestamp column by default
Here are some initial patches in need of review and heavy testing. Any feedback would be greatly appreciated. (In reply to Katrin Fischer from comment #3) > This table does handle column visibility a bit different than others - not > sure it needs to stay that way, but worth looking into when tackling the > project maybe. I decided to switch the way this table handled column visibility to match that of the items table on the details page. I find this to be an improvement but if anyone disagrees, let me know.
Created attachment 170507 [details] [review] Bug 37637: Hide the timestamp column by default Signed-off-by: Catrina <catrina@bywatersolutions.com>
Adding items, filtering and sorting all work for me as expected.
Doesn't apply cleanly anymore.
Created attachment 170789 [details] [review] Bug 37637: Use the API to load the items table This patch removes the previous use of the database to load the additem table and instead uses the API. To test: 1) Test the current datatable behavior: visit an item's detail page and select 'Edit' then 'Edit items' 2) Apply the patches, restart_all, reset_all, clear caches, etc. 3) Again, test the table behaviors. Try adding items, using the actions, filtering and sorting the items, etc.
Created attachment 170790 [details] [review] Bug 37637: Hide the timestamp column by default Signed-off-by: Catrina <catrina@bywatersolutions.com>
Rebased, but still needs more work due to Bootstrap changes. Action buttons no longer work.
Also, just like the catalog detail page the date_last_seen should be datetime. ( See 37688)
The header is broken: https://snipboard.io/8pyjWM.jpg => Library columns should have a dropdown list for the filter => Headers are missing https://snipboard.io/zhOF5j.jpg => Column list is missing labels "Home library" actually displays barcodes. Please fix those obvious errors and I will try to come back.
"Actions" menu is not opening
Created attachment 171953 [details] [review] Bug 37637: (follow-up) Fix action menu