[CLOSED] Need RowEditor ValidateEdit Listener and DirectEvent Example

  1. #1

    [CLOSED] Need RowEditor ValidateEdit Listener and DirectEvent Example



    Can you direct me to examples of RowEditor's ValidateEdit for both the client script and the codebehind? What I am trying to figure out is:

    1. Which is easier?

    2. Is the following definition of the DirectMethod valid?

    <ValidateEdit OnEvent="validateLineMethod" >
      <ExtraParams>
        <ext:Parameter Name="LineItemID" Value="r.data.LineItemID" Mode="Raw" />
        <ext:Parameter Name="field" Value="e.field" Mode="Raw" />
        <ext:Parameter Name="newvalue" Value="e.value" Mode="Raw" />
        <ext:Parameter Name="approved" Value="r.data.Approved" Mode="Raw" />
        <ext:Parameter Name="paidAmount" Value="r.data.PaidAmount" Mode="Raw" />
        <ext:Parameter Name="denied" Value="r.data.Denied" Mode="Raw" />
      </ExtraParams>
    </ValidateEdit>
    3. What should I return from the public method validateLineMethod to cause the validation to fail the save edit and cause the save to fail?

    Thanks.
  2. #2

    RE: [CLOSED] Need RowEditor ValidateEdit Listener and DirectEvent Example

    Hi,

    1. Which is easier?

    Which technique to use would depend on your requirements.


    2. Is the following definition of the DirectMethod valid?

    No, ValidateEdit event of the RowEditor has no e argument. It has
    el - roweditor This object
    o - changes Object with changes made to the record, like {dataIndex: newvalue, dataIndex1: newValue1}.
    r - The Record that was edited.
    rowIndex - The rowIndex of the row just edited



    Therefore you can use the following ExtraParams to submit old and new values


    <ext:Parameter Name="new" Value="o" Mode="Raw" Encode="true"/>

    <ext:Parameter Name="old" Value="r.data" Mode="Raw" Encode="true"/>

    What should I return from the public method validateLineMethod to cause the validation to fail the save edit and cause the save to fail?

    Unfortunately, you have to use client side method to cancel changes (you have to return false from javscript method which listens validateedit event, direct event is async operation therefore it cannot return anything)


    Or you can pass record id as extra parameter


    <ext:Parameter Name="id" Value="r.id" Mode="Raw" />

    And reject record changes on the server side


    Store1.AddScript("{0}.getById({1}).reject();", Store1.ClientID, e.ExtraParams["id"]);
  3. #3

    RE: [CLOSED] Need RowEditor ValidateEdit Listener and DirectEvent Example



    Seems easier to write it as a Listener so that there is no decoding required and so that the validation can seamlessly abandon changes when error is found. It would have helped me to have a sample to work from, but I figured it out. It works great.

    Thanks.

Similar Threads

  1. [CLOSED] RowEditor and Listener CancelEdit
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 11
    Last Post: Apr 06, 2012, 10:57 AM
  2. [CLOSED] DirectEvent/Listener on TextField as you type
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 15, 2012, 4:47 PM
  3. [CLOSED] Indicator Icon Listener and Directevent
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 19
    Last Post: Nov 14, 2011, 6:29 PM
  4. [CLOSED] [1.0] GridPanel RowEditor Plugin ValidateEdit problem
    By kemalyigit in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 29, 2010, 10:51 AM
  5. [CLOSED] Issue with roweditor and directevent
    By turione in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 07, 2010, 2:18 PM

Posting Permissions