Kkula
Browse Questions » WinCC Unified Systems: Choose Command Within User-defined Web Management Table, Windows control center Combined

About User

Questions Asked: 37.9K

Answers Given: 32

0
  • Open

WinCC Unified Systems: Choose Command Within User-defined Web Management Table, Windows control center Combined

Dear experts,
I'm using project example below for custom web control table
Integrating user-defined controls into WinCC Unified (Custom Web Controls) - ID: 109779176 - Industry Support Siemens
My question is how we get a selected row data (with mouse click)?
I'm new with javascript code
Thanks in advance
Regards,
Atabik

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Getting Selected Row Data in WinCC Unified Custom Web Controls

Dear Atabik,

Based on the Siemens Industry Support ID 109779176, to retrieve data from a selected row in your custom web control table (using JavaScript), you'll need to handle the 'rowClick' event of the table.

Here's a general approach:

  1. Event Handling: In your JavaScript code, listen for the 'rowClick' event on the table control.
  2. Accessing Row Data: Within the event handler function, access the selected row's data using the table's API. Typically, this involves getting the row index and then accessing the cell values within that row.
  3. Data Extraction: Extract the data from the cells you need.

Example Snippet (Conceptual):


// Assuming 'myTable' is the ID of your table control
myTable.onRowClick = function(row, column) {
  // 'row' is the row index
  // 'column' is the column index (if needed)

  var rowData = myTable.getRowData(row); 
  //This function depends on your specific table implementation.  
  //Refer to the table control's documentation for the correct method.

  //Access values by column index. For example:
  var value1 = rowData[0];
  var value2 = rowData[1];

  //Do something with the selected row data
  console.log("Selected Row Data:", value1, value2);
};

Important: The specific methods for getting row data (e.g., getRowData) will depend on the specific JavaScript table library or control you are using within WinCC Unified. Refer to the documentation for that particular library for details.

As you're new to JavaScript, start with simple examples and gradually build up your code. Don't hesitate to consult the Siemens documentation and online resources for further assistance.

Best regards,
Siemens Self Support

0