[CLOSED] Rowediting - disable Key Record Field when updating the row

  1. #1

    [CLOSED] Rowediting - disable Key Record Field when updating the row

    consider the following example [https://examples2.ext.net/#/GridPane...ditor_Remote/]

    Click image for larger version. 

Name:	RowEdit.png 
Views:	96 
Size:	23.3 KB 
ID:	5724

    consider I'm not so practice with client side code prog.:

    1. How could I set the key record field as disabled when I enter the row editing in update mode (double click on the row) and leave it enabled only in insert mode (after button Add is pressed) ?

    2. if i need to add action code after button Update in row edited is pressed, is it correct to do it in ValidateSave func. or are there other events that should be better to use?

    thanks
  2. #2
    Hi,

    1. Set ItemID for editor field (for example, Name) and use the following listener in RowEditing plugin
    <BeforeEdit Handler="this.editor.getComponent('Name').setDisabled(!e.record.phantom);" />
    2. Event may depend from action code which you should execute. Final event is Edit, ValidateEdit is called before edit (if ValidateEdit returns false then editing will be canceled)
  3. #3
    Thanks,

    furthermore, which is the difference between using SaveHandler on RowEditing or defining a listener ValidateEdit and Edit ?

    thanks again

                                        <ext:RowEditing ID="RowEditing1" runat="server" SaveHandler="validateSave">
                                            <Listeners>
                                                <BeforeEdit Handler="this.editor.getComponent('ediClusterId').setDisabled(!e.record.phantom);" />
                                                <ValidateEdit Handler="......." />
                                                <Edit Handler="......." />
                                            </Listeners>
                                        </ext:RowEditing>
  4. #4
    Using SaveHandler you can able to perform remote validations
    ValidateEdit allows client side validations only because required return validation status from event handler
    Edit event is fired after success editing of record

    Here is docs for those events
    http://docs.sencha.com/ext-js/4-1/#!...t-validateedit
    http://docs.sencha.com/ext-js/4-1/#!...ing-event-edit
  5. #5
    Quote Originally Posted by Vladimir View Post
    Hi,

    1. Set ItemID for editor field (for example, Name) and use the following listener in RowEditing plugin
    <BeforeEdit Handler="this.editor.getComponent('Name').setDisabled(!e.record.phantom);" />
    2. Event may depend from action code which you should execute. Final event is Edit, ValidateEdit is called before edit (if ValidateEdit returns false then editing will be canceled)
    Vladimir, this works but I need to get in the values passed to the validation function also the key field I have disabled.
    In the JsonObject values I can find only the enabled field subject of the update.
    public object ValidateSave(bool isPhantom, JsonObject values)
    is it possible?
    Thnaks
  6. #6
    If you need to submit disabled fields then you can enable it before calling getValues and disable after again
    this.getComponent('Name').setDisabled(false);
                        App.direct.ValidateSave(plugin.context.record.phantom, this.getValues(false, false, false, true), {
                            success : function (result) {
                                if (!result.valid) {
                                    Ext.Msg.alert("Error", result.msg);
                                    return;
                                }
    
    
                                plugin.completeEdit();
                            }
                        });
                        this.getComponent('Name').setDisabled(!plugin.context.record.phantom);
  7. #7
    ok, thanks, it worked

Similar Threads

  1. Replies: 0
    Last Post: Nov 20, 2012, 1:08 PM
  2. Replies: 2
    Last Post: Nov 17, 2012, 3:20 AM
  3. Replies: 4
    Last Post: Oct 25, 2012, 2:02 PM
  4. [CLOSED] Data Store not updating record mapping from codebehind
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 08, 2010, 4:42 PM
  5. Replies: 2
    Last Post: May 04, 2009, 4:52 AM

Tags for this Thread

Posting Permissions