Editable Grid Problem

Hi all,

Could somebody tell me what is wrong with this code:

 

a!gridLayout(
 totalCount: count(local!data),
 headerCells: {
   a!gridLayoutHeaderCell(label: "Datum" ),
   a!gridLayoutHeaderCell(label: "Oznaka" ),
   a!gridLayoutHeaderCell(label: "Sreden" ),
   a!gridLayoutHeaderCell(label: "DrzavaAng" ),
   a!gridLayoutHeaderCell(label: "NazivAng" ),
   a!gridLayoutHeaderCell(label: "" )
 },
 columnConfigs: {
   a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
   a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
   a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
   a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
   a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
   a!gridLayoutColumnConfig(width: "ICON")
 },
 rows: a!forEach(
   items: local!data,
   expression: a!gridRowLayout(
     id: fv!index,
     contents: {
       a!textField(
         label: "Datum "& fv!index ,
         value: fv!item.Datum,
         saveInto: fv!item.Datum,
         required: true
       ),
       a!textField(
         label: "Oznaka " & fv!index,
         value: fv!item.Oznaka,
         saveInto: fv!item.Oznaka,
         required:true
       ),
       a!textField(
         label: "Sreden" & fv!index,
         value: fv!item.Sreden,
         saveInto: fv!item.Sreden,
         required:true
       ),
       a!textField(
         label: "DrzavaAng" & fv!index,
         value: fv!item.DrzavaAng,
         saveInto: fv!item.DrzavaAng,
         required:true
       ),
       a!textField(
         label: "Naziv Ang." & fv!index,
         value: fv!item.NazivAng,
         saveInto: fv!item.NazivAng,
         required:true
       ),
       a!imageField(
                label: "delete " & fv!index,
                images: a!documentImage(
                  document: a!iconIndicator("REMOVE"),
                  altText: "Remove Entry",
                  caption: "Remove " & fv!item.Oznaka,
                  link: a!dynamicLink(
                    value: fv!index,
                    saveInto: {
                      a!save(local!data, remove(local!data, save!value))
                    }
                  )
                ),
                size: "ICON"
              )
     }
   ),
   addRowlink: a!dynamicLink(
    label: "Add Entry",
    saveInto: {
     a!save(local!data, append(local!data, save!value))
    }
 )
)

 

The error on test that it generated, when I add new row is :

 

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 102]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!dateTimeField [line 107]: Invalid index: Cannot index property 'Datum' of type Text into type DataSubset

 

And when I try to remove it remove the whole table with the Remove Icon on the first row.

 

Thanks in advance,Natasa

 

 

  Discussion posts and replies are publicly visible

Parents
  • Hi natasa,

    Can you please explain clearly
    it means what type of data you want to show in your grid ..and what type of data you want to remove from the grid ...?

    below code is for sample editable grid ....... 

    load(
    local!data:{{ id: 1, Datum: "John" , Oznaka: "Smith" , Sreden: "Engineering" , DrzavaAng: "Director" , NazivAng: "555-123-4567"  },
          { id: 2, Datum: "Michael" , Oznaka: "Johnson" , Sreden: "Finance" , DrzavaAng: "Analyst" , NazivAng: "555-987-6543"  },
          { id: 3, Datum: "Mary", Oznaka: "Reed" , Sreden: "Engineering" , DrzavaAng: "Software Engineer" , NazivAng: "555-456-0123"  },
      },
    
    a!gridLayout(
     totalCount: count(local!data),
     headerCells: {
       a!gridLayoutHeaderCell(label: "Datum" ),
       a!gridLayoutHeaderCell(label: "Oznaka" ),
       a!gridLayoutHeaderCell(label: "Sreden" ),
       a!gridLayoutHeaderCell(label: "DrzavaAng" ),
       a!gridLayoutHeaderCell(label: "NazivAng" ),
       a!gridLayoutHeaderCell(label: "remove" )
     },
     columnConfigs: {
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "ICON")
     },
     rows: a!forEach(
       items: local!data,
       expression: 
       a!gridRowLayout(
         id: fv!index,
         contents: {
           a!textField(
             label: "Datum "& fv!index ,
             value: fv!item.Datum,
             saveInto: fv!item.Datum,
             required: true
           ),
           a!textField(
             label: "Oznaka " & fv!index,
             value: fv!item.Oznaka,
             saveInto: fv!item.Oznaka,
             required:true
           ),
           a!textField(
             label: "Sreden" & fv!index,
             value: fv!item.Sreden,
             saveInto: fv!item.Sreden,
             required:true
           ),
           a!textField(
             label: "DrzavaAng" & fv!index,
             value: fv!item.DrzavaAng,
             saveInto: fv!item.DrzavaAng,
             required:true
           ),
           a!textField(
             label: "Naziv Ang." & fv!index,
             value: fv!item.NazivAng,
             saveInto: fv!item.NazivAng,
             required:true
           ),
           a!imageField(
                    label: "delete " & fv!index,
                    images: a!documentImage(
                      document: a!iconIndicator("REMOVE"),
                      altText: "Remove Entry",
                      caption: "Remove " & fv!item.Oznaka,
                      link: a!dynamicLink(
                        value: fv!index,
                        saveInto: {
                          a!save(local!data, remove(local!data, save!value))
                        }
                      )
                    ),
                    size: "ICON"
                  )
         })
       ),
        addRowlink: a!dynamicLink(
              label: "Add Employee",
              /*
               * For your use case, set the value to a blank instance of your CDT using
               * the type constructor, e.g. type!Employee(). Only specify the field
               * if you want to give it a default value e.g. startDate: today()+1.
               */
             
              saveInto: {
                a!save(local!data, append(local!data, save!value))
              }
            )
    )
    
    
    )

    Thank you..

Reply
  • Hi natasa,

    Can you please explain clearly
    it means what type of data you want to show in your grid ..and what type of data you want to remove from the grid ...?

    below code is for sample editable grid ....... 

    load(
    local!data:{{ id: 1, Datum: "John" , Oznaka: "Smith" , Sreden: "Engineering" , DrzavaAng: "Director" , NazivAng: "555-123-4567"  },
          { id: 2, Datum: "Michael" , Oznaka: "Johnson" , Sreden: "Finance" , DrzavaAng: "Analyst" , NazivAng: "555-987-6543"  },
          { id: 3, Datum: "Mary", Oznaka: "Reed" , Sreden: "Engineering" , DrzavaAng: "Software Engineer" , NazivAng: "555-456-0123"  },
      },
    
    a!gridLayout(
     totalCount: count(local!data),
     headerCells: {
       a!gridLayoutHeaderCell(label: "Datum" ),
       a!gridLayoutHeaderCell(label: "Oznaka" ),
       a!gridLayoutHeaderCell(label: "Sreden" ),
       a!gridLayoutHeaderCell(label: "DrzavaAng" ),
       a!gridLayoutHeaderCell(label: "NazivAng" ),
       a!gridLayoutHeaderCell(label: "remove" )
     },
     columnConfigs: {
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
       a!gridLayoutColumnConfig(width: "ICON")
     },
     rows: a!forEach(
       items: local!data,
       expression: 
       a!gridRowLayout(
         id: fv!index,
         contents: {
           a!textField(
             label: "Datum "& fv!index ,
             value: fv!item.Datum,
             saveInto: fv!item.Datum,
             required: true
           ),
           a!textField(
             label: "Oznaka " & fv!index,
             value: fv!item.Oznaka,
             saveInto: fv!item.Oznaka,
             required:true
           ),
           a!textField(
             label: "Sreden" & fv!index,
             value: fv!item.Sreden,
             saveInto: fv!item.Sreden,
             required:true
           ),
           a!textField(
             label: "DrzavaAng" & fv!index,
             value: fv!item.DrzavaAng,
             saveInto: fv!item.DrzavaAng,
             required:true
           ),
           a!textField(
             label: "Naziv Ang." & fv!index,
             value: fv!item.NazivAng,
             saveInto: fv!item.NazivAng,
             required:true
           ),
           a!imageField(
                    label: "delete " & fv!index,
                    images: a!documentImage(
                      document: a!iconIndicator("REMOVE"),
                      altText: "Remove Entry",
                      caption: "Remove " & fv!item.Oznaka,
                      link: a!dynamicLink(
                        value: fv!index,
                        saveInto: {
                          a!save(local!data, remove(local!data, save!value))
                        }
                      )
                    ),
                    size: "ICON"
                  )
         })
       ),
        addRowlink: a!dynamicLink(
              label: "Add Employee",
              /*
               * For your use case, set the value to a blank instance of your CDT using
               * the type constructor, e.g. type!Employee(). Only specify the field
               * if you want to give it a default value e.g. startDate: today()+1.
               */
             
              saveInto: {
                a!save(local!data, append(local!data, save!value))
              }
            )
    )
    
    
    )

    Thank you..

Children
No Data