Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
id of row in a subgrid
31/01/2014
14:39
Avatar
aw_jqgrid
Member
Members
Forum Posts: 3
Member Since:
16/06/2012
sp_UserOfflineSmall Offline

Hello,

I'm stuck on a problem. I need to change the value of a cell in a subgrid depending on the vlaue of a select in the same row of this subgrid. I get the row_id, but it is from the grid. The id itself in the subgrid I don't get. perhaps you can help me.

This is the row, where I want it:                       alert("Baustoff geändert "+row_id);

 

   // Grid
    $("#Abnahmen_Table").jqGrid
    ({
        // Options
        url:     "../includes/abnahme/IncAbnahmeAbnahmen.php?action=load",
        editurl: "../includes/abnahme/IncAbnahmeAbnahmen.php?action=save",
    mtype: "POST",
        datatype: "json",
        caption: "Abnahmen",
    idPrefix: "Abnahmen_",
        colNames:
        [
            '',
      'ID Act',
            'Datum',
      'Messung',
      'Raum T',
      'Raum F',
      'Wand T',
            'Handlungsbedarf',
            'Kunde',
            'Ecodry',
            'Bemerkung'
        ],
        colModel:
        [
            {name:'Action', width:'60px', fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}},
            {name:'User_Id', width:'60px', index:'User_Id', editable:false, edittype:'text', frozen:true, align:'right'},
            {name:'Abnahme_Timestamp', width:'80px', index:'Abnahme_Timestamp', editable:true, edittype:'text', sorttype:"date", editoptions:{size:10, maxlength:10, dataInit: function(element){$(element).datepicker({numberOfMonths: 3, dateFormat: 'dd.mm.yy'})}}},
            {name:'Abnahme_Typ', width:'120px', index:'Abnahme_Typ', editable:true, edittype:"select", formatter:"select", editoptions:{value:"1:Basismessung;2:Kontrollmessung;3:Schlussmessung;4:Sondermessung"}},
      {name:'Abnahme_Raumtemperatur', index: 'Abnahme_Raumtemperatur', width:'50px', editable:true, edittype:'text', formatter:numFormat, formatoptions:{defaultValue:''}, align:'right'},
      {name:'Abnahme_Raumfeuchte', index: 'Abnahme_Raumfeuchte', width:'50px', editable:true, edittype:'text', formatter:numFormat, formatoptions:{defaultValue:''}, align:'right'},
      {name:'Abnahme_Wandtemperatur', index: 'Abnahme_Wandtemperatur', width:'50px', editable:true, edittype:'text', formatter:numFormat, formatoptions:{defaultValue:''}, align:'right'},
            {name:'Abnahme_Aktion', width:'400px', index:'Abnahme_Aktion', editable:true, edittype:'text'},
            {name:'Abnahme_Aktion_Kunde', width:'60px', align:'center', index:'Abnahme_Aktion_Kunde', editable:true, edittype:'checkbox', formatter:'checkbox', editoptions:{value:"1:0"}},
            {name:'Abnahme_Aktion_Ecodry', width:'60px', align:'center', index:'Abnahme_Aktion_Ecodry', editable:true, edittype:'checkbox', formatter:'checkbox', editoptions:{value:"1:0"}},
            {name:'Abnahme_Bemerkung', width:'400px', index:'Abnahme_Bemerkung', editable:true, edittype:'text'}
        ],
        sortname: "Abnahme_Timestamp",
        rowNum: 20,
        scroll: true,
        pager: "#Abnahmen_Pager",
        viewrecords: true,
        autowidth: true,
    shrinkToFit: false,
        height: 260,
//    hiddengrid: true,

        // Events
    ondblClickRow: function(nId)
        {
            if(nId && nId!=nSelectedLast)
            {
                $(this).jqGrid('saveRow',nSelectedLast);
                nSelectedLast=nId;
            }
            
      // Datensatz ändern
      $(this).jqGrid('editRow', nId, true);
        },

        subGrid: true,
        subGridRowExpanded: function(subgrid_id, row_id)
        {
            // Variablen
      var subgrid_table_id1;
            subgrid_table_id1 = subgrid_id+"_Subgrid_1";
      var pager_id1 = "p_" + subgrid_table_id1;

      // Subgrids
      jQuery("#"+subgrid_id).html("<div style='margin:20px'><table id='" + subgrid_table_id1 + "' class='scroll'></table><div id='" + pager_id1 + "'></div></div>");

      // 1. Subgrid
      $("#"+subgrid_table_id1).jqGrid
      ({
        // Options
        url:     "../includes/abnahme/IncAbnahmeAbnahmenMesswerte.php?action=load&Abnahme_Id="+row_id.split("_").pop(),
        editurl: "../includes/abnahme/IncAbnahmeAbnahmenMesswerte.php?action=save&Abnahme_Id="+row_id.split("_").pop(),
        mtype: "POST",
        datatype: "json",
        caption: "Messwerte",
        idPrefix: "Messwerte_",
        colNames:
        [
          '',
              'ID Act',
          'Messstelle',
          'Baustoff',
          'Salzgehalt',
          'Naturfeuchte',
          'Oben',
          'Mitte',
          'Unten',
          'Bemerkung'
        ],
        colModel:
        [
          {name:'Action', width:'60px', fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}},
                    {name:'User_Id', width:'60px', index:'User_Id', editable:false, edittype:'text', frozen:true, align:'right'},
          {name:'Messwert_Messstelle', width:'80px', index:'Messwert_Messstelle', editable:true, edittype:"select", editoptions:{value:"<?php echo $strMessstellen ?>"}, align:'center'},
          {name:'Messwert_Baustoff', width:'160px', index:'Messwert_Baustoff', editable:true, edittype:"select", formatter:"select", editoptions:
              {
                value:"<?php echo $strBaustoffe ?>",
                            dataEvents:
              [
                {
                    type: 'change',
                  fn: function(e)
                  {
//                      alert("Baustoff geändert "+row_id);
                  }
                }
              ]          
          
              }},
          {name:'Messwert_Salzgehalt', width:'80px', index:'Messwert_Salzgehalt', editable:true, edittype:"select", formatter:"select", editoptions:
              {
                value:"0:;1:Ohne;2:Leicht;3:Stark;4:Extrem",
                            dataEvents:
              [
                {
                    type: 'change',
                  fn: function(e)
                  {
//                      alert("Baustoff geändert "+row_id);
                  }
                }
              ]          
          
              }},
          {name:'Messwert_Naturfeuchte', index: 'Messwert_Naturfeuchte', width:'70px', editable:true, edittype:'text', formatter:numFormat, align:'right'},
          {name:'Messwert_Messwert_Oben', index: 'Messwert_Messwert_Oben', width:'60px', editable:true, edittype:'text', formatter:numFormat, align:'right'},
          {name:'Messwert_Messwert_Mitte', index: 'Messwert_Messwert_Mitte', width:'60px', editable:true, edittype:'text', formatter:numFormat, align:'right'},
          {name:'Messwert_Messwert_Unten', index: 'Messwert_Messwert_Unten', width:'60px', editable:true, edittype:'text', formatter:numFormat, align:'right'},
          {name:'Messwert_Bemerkung', width:'400px', index:'Messwert_Bemerkung', editable:true, edittype:'text'}
        ],
        sortname: "Messwert_Messstelle",
        rowNum: 10,
        scroll: true,
        pager: pager_id1,
        viewrecords: true,
        autowidth: true,
        shrinkToFit: false,
        height: "70px",
//        hiddengrid: true,

        // Events
        onSelectRow: function(nId)
        {
                    // beim Zeilenwechsel Änderungen speichern
          if(nId && nId!=nSelectedLast)
          {
            $("#"+subgrid_table_id1).jqGrid('saveRow',nSelectedLast);
            nSelectedLast=nId;
          }

          // Datensatz ändern
          $("#"+subgrid_table_id1).jqGrid('editRow', nId, true);
        },
      })

      // 1. Subgrid Navigator
      $("#"+subgrid_table_id1).jqGrid
      (
        'navGrid',
        "#"+pager_id1,
        {add:true, edit:false, del:false, search:false},
        {
          // Edit
        },
        {
          // Add
          recreateForm: true,
          closeAfterAdd: false
        },
        {
          // Delete
        },
        {},
        {}
      );
        }
    });

    // Grid Navigator
    $("#Abnahmen_Table").jqGrid
  (
      'navGrid',
    "#Abnahmen_Pager",
    {add:true, edit:false, del:false, search:false},
    {
        // Edit
    },
    {
        // Add
        recreateForm: true,
      closeAfterAdd: true
    },
    {
        // Delete
    },
    {},
    {}
  );

Thanks in advance

Andi

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information