Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • nikolayo
    replied
    P.S. : Very sorry about the typo. I meant "usUnique" validators.

    Leave a comment:


  • nikolayo
    replied
    Thank you. It is good to know that redundant validation requests are not an expected behavior. What I noticed for now is that they only happen with grids which are brought up as an expansion component of another grid. Will be digging further...

    Any hints on the issue of access to values of unchanged fields in validators upon update? As I wrote, I in a way solve it but now I have problems with built-in "isRequired" validators. Apparently they do not buy updates of correspondent fields even if the value is not really changed.

    Leave a comment:


  • Isomorphic
    replied
    It's not normal, even with those settings, to see a request for validation followed by a separate request for save. The code you've posted, if added to a sample, will not reproduce the problem. Let us know if you can modify a sample to reproduce the problem.

    Leave a comment:


  • nikolayo
    replied
    P.S.S.: I worked out a way to avoid pulling unchanged fields from the database. I do that by forcing within a custom data source full update like this:
    Code:
            Map newValues = req.getValues();
            Map oldValues = req.getOldValues();
            Set oldKeys = oldValues.keySet();
            for (Object key : oldKeys) {
                if (newValues.get(key) == null) {
                    newValues.put(key, oldValues.get(key));
                }
            }
    This solves my most annoying problem but the solution is still suboptimal. And there is still redundancy in the requests (validation request(s) followed unconditionally by create/update which trigger validation again).

    Leave a comment:


  • nikolayo
    replied
    P.S.: I added just in case setSaveByCell(false) and setValidateByCell(false) and nothing changed. Here is all my grid initialization code :
    Code:
            final ListGrid detailGrid = new ListGrid();
            detailGrid.setWidth100();
            detailGrid.setHeight(224);
            detailGrid.setCellHeight(22);
            detailGrid.setShowRowNumbers(true);
            detailGrid.setCanEdit(detailPermissions.isUpdateAllowed());
            detailGrid.setLayoutAlign(Alignment.CENTER);
            detailGrid.setAutoSaveEdits(true);
            detailGrid.setConfirmDiscardEdits(true);
            detailGrid.setConfirmCancelEditing(true);
            detailGrid.setSaveByCell(false);
            detailGrid.setValidateByCell(false);
            detailGrid.setDataSource(detailSource);

    Leave a comment:


  • nikolayo
    replied
    I probably did not explain this clearly enough. Submission to the server does not happen upon individual cell changes but when I finish editing a row.

    Leave a comment:


  • Isomorphic
    replied
    Stop at #1 - that's not normal and suggests bad settings. You may have set saveByCell:true (causing updates on every cell change) while also setting validateByCell:true?

    If you only want to save on row change (the default) set both to false.

    Leave a comment:


  • nikolayo
    started a topic Strange behavior of server side validation

    Strange behavior of server side validation

    I am experimenting with server side validation of ListGrid data and the behavior I observe is:

    1/ Whenever a field is changed and the change is submitted to the grid, the grid sends unconditionally to the server 2 requests: one for validation and then one for update.
    2/ On the server my custom validator is called by SQLDataSource 2 times - once during execution of the validation request and once during execution of the update request.
    3/ On the first call to the validator it gets (in the "record" parameter) data which is a merge of the changed values and the old valies in the request.
    4/ On the second call to the validator it gets only the primary key and the new values.
    5/ Whenever a new record is submitted to the grid it issues as many validation requests to the server as is the number of fields with attached server side validators followed by a create request.

    The problems I have with all this are:

    1/ Why the grid issues upon data change a validation request if it is unconditionally followed by an update request which triggers validation too?
    2/ Why are the validation requests upon record creation so many and why are they issued at all if the unconditionally following create operation triggers validation too?
    2/ Why is it that during an update operation the (SQL) data source does not merge changed and old values prior to calling the validator(s)?
    3/ Is there a way to get hold of the old values from the request in my custom validator? I looked at all required and optional arguments and found so far no way that would make sense.

    The reason why old data matters much to me is that I want to be able to do validation based on relations between feelds (e.g. - comparison) rather than individual values only. At present I am forced to pull old data from the database which is doable but much more expensive than getting the old data from the request.

    Can somebody please answer the questions above?
Working...
X