[CLOSED] Accessing Row value in row click renderer function

  1. #1

    [CLOSED] Accessing Row value in row click renderer function

    Hi,

    I want to access the record values when I click on the row.
    I am able to get the value of a particular column value in the java script function but not the entire row.
    Please let me know how to access the entire row.

    Regards,
    Etisbew

  2. #2

    RE: [CLOSED] Accessing Row value in row click renderer function

    Hi Etisbew,

    An instance of the following values are passed to the Renderer:


    value, metadata, record, rowIndex, colIndex, store

    The third value (record) contains all the data for the record. You can access individual values from the .data object.


    Example


    alert(record.data.company

    Documentation for each of the renderer arguments is available at
    http://extjs.com/deploy/dev/docs/?cl...er=setRenderer


    Hope this helps.


    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Accessing Row value in row click renderer function


    Can you give an example to access the row values in either Java Script and Code Behind


  4. #4

    RE: [CLOSED] Accessing Row value in row click renderer function



    Hello,

    Try the following;

    HTML in the Gridpanel section...
     <AjaxEvents>
     <CellClick OnEvent="ShowData" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
         <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{GridPanel1}.body}" />
         <ExtraParams>
      <ext:Parameter Name="Grid1" Value="Ext.encode(#{GridPanel1}.getRowsValues(true))" Mode="Raw" />
         </ExtraParams>
     </CellClick>
       </AjaxEvents>
    Codebehind ....
     protected void ShowData(object sender, AjaxEventArgs e)
      {
    
    
          string grid1Json = e.ExtraParams["Grid1"];
          
          Dictionary<string, string>[] grid1Data = JSON.Deserialize<Dictionary<string, string>[]>(grid1Json);
          
          
              foreach (IDictionary<string, string> properties in grid1Data)
              {
               // Your data will be in 
               string data1 = proprties["YourFieldData"]; (Columns in your grid)
               ........
              }
    
    
      }
    Hope it helps,
  5. #5

    RE: [CLOSED] Accessing Row value in row click renderer function

    Hi Ernesto,

    Thanks for the reply, I got the expected result with your support, thanks once again.

    But I had another requirement, I am trying to get the record value in the rendrer function (Fn) javascript function but I was not able to get it, I am able to get the "value" but not entire "record" .

    I want this while record is preparing in the grid why because, I need to set an image to a column depending on the other column value.

    Can anyone help in getting the row value in java script meathod with a small example


  6. #6

    RE: [CLOSED] Accessing Row value in row click renderer function

    Hi,

    I got the solution for my above mentioned requirement
    Till now I am not sure about the signature of the renderer function that made me scracth mt head ;-)
    Thanks for ever body

    Now you can make this thread solved.

    Javascript function
      function getIconID(v, p, record, rowIndex) {
    
                alert(record.data.IconId);
    }

Similar Threads

  1. [CLOSED] Renderer function
    By tanky65 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 30, 2012, 7:21 PM
  2. [CLOSED] GridPanel. Force renderer function of column
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 25, 2012, 5:45 PM
  3. [CLOSED] Failure function after button click
    By mcfromero in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 19, 2012, 3:05 PM
  4. Replies: 4
    Last Post: May 31, 2011, 11:54 AM
  5. Replies: 1
    Last Post: Jan 17, 2011, 11:18 PM

Posting Permissions