This topic is locked

updating a drop down value of all selected records in JS

6/15/2021 9:36:14 PM
PHPRunner General questions
C
chandoshi authorDevClub member

After selecting multiple records to edit , I am triggering the following code in "Field_events" - "Client Before".

  1. update "isChild" checkbox to "checked" - this works perfectly
  2. update "GrpLink" dropdown - set selected value to parentKey variable . This does not work. What should I be using insted of (attr('selected',parentKey))

//save key value of current record
var parentKey = row.getKeys();
var selectedRecords = pageObj.getSelectedRecords();
if( selectedRecords.length == 0 )
return false;
selectedRecords.forEach( function( ajaxRow, idx ) {
// update isChild checkbox to "Checked" - works perfectly
$("input[name='valueisChild"+ajaxRow.row["id"]+"'][id='valueisChild"+ajaxRow.row["id"]+"']").attr('checked','checked');
//This code does not work
$("input[name='valueGrpLink"+ajaxRow.row["id"]+"'][id='valueGrpLink"+ajaxRow.row["id"]+"']").attr('selected',parentKey);
});