Sheet update data

Community Driven Extensions Project
Post Reply
bug007
Posts: 39
Joined: 07 Oct 2015, 12:08

30 Jul 2018, 18:16

Hi,
version 6.2.7
I have implemented a pe:sheet with ajax event="change" like in showwcase, but when ajax completed and Manage Bean change event is done , I need to update data on the sheet.
Than i use update property like this :

Code: Select all

<p:ajax event="change" listener="#{sheetAjaxController.cellChangeEvent}" update"sheet" /> 

Data are update (YES), but navigation on the sheet too (Wrong)! This is mean, if event change event is fire when you tab on the sheet, you must go to the next cell => this is not work if sheet is update.

How is it possible to update data on the sheet without lots layout moving in the cell ?

Thanks for your help.

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

30 Jul 2018, 18:34

What happens if you remove the update="sheet"?

See this example? https://www.primefaces.org/showcase-ext ... cUsage.jsf

Change "Price" value from positive to negative you will see the cell tab and the style updates from Green to Red with no need to call update="" on the whole sheet?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

bug007
Posts: 39
Joined: 07 Oct 2015, 12:08

30 Jul 2018, 19:10

Yes this work if you don't need to update nothing, just take the change like it is.
But in my case, I need update sheet for 2 raisons :
- first, when value is remove or blanck, I would like to put a default value. Than I need to change the newValue on the managed bean like a 'setNewValue()' but this propertyClass doen't exist. I change data value and update sheet, like a dataTable !
- second, when a new value is set, I make on the bean a line control to look if it's complet (User control between different value on the same row), If line is 'complet', i need to update styleClass property of all "pe:column" of this row to put line in 'green' to seem's this line is OK

Another way to need update the sheet and it is also an issue, it is after the addHook ('afterCreateRow') on the contextMenu : I would like to insert a line whith some default value. I call a bean with p:remoteCommand to insert a new line on database and put default value on it and on the sheet. The only way I found to update the sheet with the default value, it's to use update property of the remoteCommand (Same problem) but in this case user navigation is less important.

In fact the need is : How can I do to maintain up to date sheet screen values and data values when one of them change without interact user navigation ?
Thanks for your help

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

30 Jul 2018, 20:08

For your more complex requirements you will probably have to use JS to hook what cell you are on before the sheet is updated and in the oncomplete="" of your AJAX update set the focused cell of the sheet to the cell you stored before the update. Basically doing it all with Javascript.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

bug007
Posts: 39
Joined: 07 Oct 2015, 12:08

31 Jul 2018, 11:05

I would like to use JS, and I hope I can do it by JS, but it's not so easily to set right focus place and if I do like this, I loose the advantage to use this component.
For exemple, user can tape some value on a cell and he can move where ever he want on the sheet : left, rigth, bottom, or outside .. (with tab, enter, cursor move, mouse click ...) => it's the lost focus who call the ajax event change. So for user need, the update musn't change his current action and he must go where he decide (isn't it), how can I know this place ???.
Other thing, I just begining use handsontable and I don't know how is it possible to do something like set focus on a cell or "prevent" a default action to do it after...
I should find something, it's our job ... Thanks

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

31 Jul 2018, 13:39

Yep your only choice for that then is not calling update="sheet". You have got to find other ways to do what you want. The whole reason we built the sheet was so you could have 10,000 cells that the PF Datatable did not support well. We wanted cell updates to update just that cell without having to update the whole Sheet. That if you edited a cell then just that cell would be sent in Ajax and updated unlike the PF datatable which would Form Submit all 10,000 values.

You are kind of defeating the whole purpose of the sheet by reloading the entire Sheet every time you make an update.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

bug007
Posts: 39
Joined: 07 Oct 2015, 12:08

02 Aug 2018, 09:50

Hi Melloware.
I would test different solution, but the best way like you suggest it's to use "standard" and "existing" things.
For example, if I want to use required property on pe:sheetcolumn, the work it is different of my need : it only work if you delete an existing value. If you tab or [enter] on theses required cells but if they are empty on load, no required information appear (red color ..) => Strange isn't it, the fields is mandatory, you said it's not like a form validation, there is no whole validation, it's at each cell. Is it a validation bug ?

Another problem, when sheet is loaded, I would like required fields appear directly in red for helping users to see where he need to work.
Something like this screenshot (Red color on the begining row and on the field in error .... very nice)
Image

How can I do this ? Do you know if it's possible to run something like validate sheet cells at on first load process ? By the way, it's not necessary to put a hundered messages required !
Thanks for your help

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

02 Aug 2018, 13:37

I think you will have to do this in Javascript and Handsontable and mark the cells as invalid which will highlight them red. Handsontable is incredibly powerful.

The "validation" only takes place when you edit a cell not when you TAB over one or when the sheet loads. Can you imagine running validation on every cell in a 10,000 cell sheet when it loads? Page load time would increase significantly and the whole reason we wrote the Sheet was for performance.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

bug007
Posts: 39
Joined: 07 Oct 2015, 12:08

02 Aug 2018, 16:29

OK I must look on JS solution.
But I thinks there are some issues on the pe:sheet update and validation process.

There are very difference between required control and validator and it was very nice to have same control for user experience and confort.
You say only the current cell it's control on edit phase, see this screen shot on showcase just after tab on required field : there are a lot of validation and not on edit and the required field is forget .

Hope this can help to improve pe:sheet implementation of handsontable ;) I'm waiting next release !

I will post here different solution if I found some really good !

Image

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests