Adding rows at specified position in a grid

Hi,

I need to add a grid row right after I cloned(click on a link) the first one. I have used insert function for that.

But still, the row is adding before the main row i.e at the starting of the grid rows

Co

a!richTextItem(
          text: a!richTextIcon(icon: "Add", caption: "Create Rows"),
          link: a!dynamicLink(
            value: ri!data[ri!index],
            saveInto: {
              a!save(
                ri!data,
                insert(
                  ri!data,
                  'type!{urn:com:appian:types}C_CDTName'(
                    Id: ri!data[ri!index].Id,
                    HeaderLine: ri!data[ri!index].HeaderLine,
                    Desc: ri!data[ri!index].Desc,
                  ), (wherecontains(ri!data[ri!index],ri!data)),
                )
              ),
          ),
          linkStyle:"STANDALONE"
        ),


Could anyone please help me on the above issue. Thanks in advance

  Discussion posts and replies are publicly visible

Parents Reply
  • Hi

    Can you please try with the "ri!index+1" for the index parameter in the Insert function. 

    It seems the index value you have given in the Insert function is to add the value at the same row. Please refer the below code

    a!richTextItem(
              text: a!richTextIcon(icon: "Add", caption: "Create Rows"),
              link: a!dynamicLink(
                value: ri!data[ri!index],
                saveInto: {
                  a!save(
                    ri!data,
                    insert(
                      ri!data,
                      'type!{urn:com:appian:types}C_CDTName'(
                        Id: ri!data[ri!index].Id,
                        HeaderLine: ri!data[ri!index].HeaderLine,
                        Desc: ri!data[ri!index].Desc,
                      ),ri!index+1,
                    )
                  ),
              ),
              linkStyle:"STANDALONE"
            ),

Children