1. Object JSSelectedIds

    Article: AN0001723Updated:

    This object contains list of records selected by means of a checkbox on tabs for master-detail relations.

    Object properties

    Name Description
    List<int> this[string code] Property returns all the selected records for the given master-detail relation.

    The object contains selected records for all the master-detail relations on page DataDetail.aspx. For getting the list for a particular master-detail relation you have to use this function with code of a particular master-detail relation.

    IDs of selected records are returned.

     

    Example:

    Button for approval in the model for capacity planning.

    var dataRowIds = OGSelectedDataRow['resources_monthly'];

    if ( dataRowIds != null && dataRowIds.Count > 0)
    {
          //nacist stavy
          var state_1 = CP_GetResStatus( 'plan', model);
          var state_2 = CP_GetResStatus( 'for_approve', model);

          var cl = OG.ClassDef.GetByCode( model.Id, 'project_year_requested_resources_monthly');
          var colStatus = OG.Column.GetByCode(cl.Id, 'requested_resource_status');

          var f = OG.DataRow.GetDataRowFilter( cl.Id);
          f.Ids = dataRowIds;
          f.Filter_OnlyActive = true;
          f.SetColumnData( colStatus.Id, state_1);

          var drList = OG.DataRow.GetDataByFilter( null, f);
          if ( drList != null)
          {
              for( var i = 0; i < drList.Count; ++i)
              {
                  var dr = drList[i];
                  dr[colStatus.Id] = state_2;
                  OG.DataRow.SaveData(dr);
              }
          }
    }

×