Author Topic: [Liquid UI Table] Read Liquid UI Table Row Selection  (Read 4940 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
[Liquid UI Table] Read Liquid UI Table Row Selection
« on: August 07, 2017, 02:51:41 PM »
Purpose: Scroll through Liquid UI table to read details from user selected row.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// User Interface
del("X[IMAGE_CONTAINER]");

var item_array = ['10','20','30','40','50','60'];
var material_array = ['L-10Y','100-300','L-80F','CP-100','C-200','L-200'];
var plant_array = ['1000','1200','1300','1400','2500','3000'];
           
// Liquid UI Table
table([1,3], [10,27], {"name":"z_table", "title":"Material List", "rows":10, "singlerowselection":true, "readonly":true});
column("Item", {"position":1, "table":"z_table", "name":"z_itemcolumn", "size":4, "readonly":true});
column("Material", {"position":2, "table":"z_table", "name":"z_matcolumn", "size":9, "maxlength":18, "readonly":true});
column("Plant", {"position":3, "table":"z_table", "name":"z_plantcolumn", "size":4, "readonly":true});     

inputfield([5,30], "Item", [5,40], {"name":"z_va0x_item", "size":3});
inputfield([6,30], "Material", [6,40], {"name":"z_va0x_mat", "size":18});
inputfield([7,30], "Plant", [7,40], {"name":"z_va0x_plant", "size":4});

pushbutton([1,30], "Clear Selection", {"process":deSelect});
pushbutton([4,30], "Read  Selection Details", {"process":readSelection});

// Populating Data

for(j=0;j<material_array.length;j++){
   z_table.z_itemcolumn[j] = item_array[j];
   z_table.z_matcolumn[j] = material_array[j];
   z_table.z_plantcolumn[j] = plant_array[j];      
}   

// Function to clear the row selection
function deSelect(){
   onscreen '*'
      for(j=0; j<item_array.length; j++){   
         z_table.selectedrows = " ";      // Deselect line items
      }
      set("V[z_va0x_*]","");
      enter('?');   
}

// Function to read the selection details (Material in this case)
function readSelection(){
   onscreen '*'
      for(j=0; j<z_table.selectedrows.length; j++){
         if(z_table.selectedrows[j] == "X"){
            set("V[z_va0x_item]",z_table.z_itemcolumn[j]);
            set("V[z_va0x_mat]",z_table.z_matcolumn[j]);
            set("V[z_va0x_plant]",z_table.z_plantcolumn[j]);
            break;      
         } else{
            if(i == z_table.selectedrows.length){
               break;
            }
         }
      }
      enter('?');   
}


See attachments for code samples!

« Last Edit: August 07, 2017, 04:47:13 PM by Benjamin Dasari »