cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Add row or delete rows from Grid

VS_9760165
13-Aquamarine

Add row or delete rows from Grid

Hi ,

I want to delete and add rows in grid with Custom service using selected Rows property of grid. i have infotable service which is returning infotable with Datashape.

how to use selected rows and delete the rows from grid?

 

Thanks

ACCEPTED SOLUTION

Accepted Solutions
Ashritha
15-Moonstone
(To:VS_9760165)

  1. Write Custom Service:
    1. Input :
      1. Selected Rows  //Infotable
      2. Grid Data  //Infotable
    2. Logic 
      1. If Selected row present - remove the selected row from Grid Data
        • Different ways of deleting row
          1.  If selected row index is known
            • GridData.RemoveRow(rowIndex)
          2. Using Query
            • Create query using selected row data
            • query :
              •  var query =
                {
                "filters": {
                "type": "And",
                "filters": [
                {
                "type": "EQ",
                "fieldName": "Prop1",
                "value": <Selected Row Prop1 value here>
                },
                {   "type": "EQ",
                "fieldName": "Prop2",
                "value": <Selected Row Prop2 value here>
                }
                ]
                }
                };
            • Then use following snippet to filter out

               

              • var params = {
                t: <Grid data infotable here> /* INFOTABLE */,
                query: query /* QUERY */
                };

                // result: INFOTABLE
                var result = Resources["InfoTableFunctions"].DeleteQuery(params);

      2. If there is no selected row - keep the grid data as it is (or usual process of populating grid data)
    3. Output:
      1. Grid data Infotable

View solution in original post

1 REPLY 1
Ashritha
15-Moonstone
(To:VS_9760165)

  1. Write Custom Service:
    1. Input :
      1. Selected Rows  //Infotable
      2. Grid Data  //Infotable
    2. Logic 
      1. If Selected row present - remove the selected row from Grid Data
        • Different ways of deleting row
          1.  If selected row index is known
            • GridData.RemoveRow(rowIndex)
          2. Using Query
            • Create query using selected row data
            • query :
              •  var query =
                {
                "filters": {
                "type": "And",
                "filters": [
                {
                "type": "EQ",
                "fieldName": "Prop1",
                "value": <Selected Row Prop1 value here>
                },
                {   "type": "EQ",
                "fieldName": "Prop2",
                "value": <Selected Row Prop2 value here>
                }
                ]
                }
                };
            • Then use following snippet to filter out

               

              • var params = {
                t: <Grid data infotable here> /* INFOTABLE */,
                query: query /* QUERY */
                };

                // result: INFOTABLE
                var result = Resources["InfoTableFunctions"].DeleteQuery(params);

      2. If there is no selected row - keep the grid data as it is (or usual process of populating grid data)
    3. Output:
      1. Grid data Infotable
Announcements


Top Tags