I want to provide a duplicate button on a grid. The grid uses the 'New Record Edit Style' to 'ShowOnDemand'
I would like to have the duplicate button hit and it open the new record edit page with data from the selected field.
I have added the following Javascript .. when it's executed the appropriate fields are copied BUT the new record is NOT selected so when I sychronously run the
'Ux alternate view of current record' action it edits the field I clicked NOT the new record .. Neither of the two Javascript functions setSelectedRow or setfocus seem to work!... Any ideas ... or is their a better alternative?
{grid.Object}.toggleNewRecordRows(); *This toggles and opens the grid to edit
fn= "USEDCONTROL"; *These lines copy the data I want to the appropriate fields
var val='';
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTTEXT";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNUMBER";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNOTES";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTIMAGE";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTTEXTAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNUMBERAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNOTESAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTIMAGEAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTCAT";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTTYPE";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
{grid.Object}.setSelectedRow(-1); *I thought this would select the first 'New Row'
{grid.Object}.setFocus(-1); * or this
I would like to have the duplicate button hit and it open the new record edit page with data from the selected field.
I have added the following Javascript .. when it's executed the appropriate fields are copied BUT the new record is NOT selected so when I sychronously run the
'Ux alternate view of current record' action it edits the field I clicked NOT the new record .. Neither of the two Javascript functions setSelectedRow or setfocus seem to work!... Any ideas ... or is their a better alternative?
{grid.Object}.toggleNewRecordRows(); *This toggles and opens the grid to edit
fn= "USEDCONTROL"; *These lines copy the data I want to the appropriate fields
var val='';
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTTEXT";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNUMBER";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNOTES";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTIMAGE";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTTEXTAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNUMBERAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTNOTESAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTIMAGEAVA";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTCAT";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
fn= "DEFAULTTYPE";
var val={grid.Object}.getValue('G',fn,{Grid.RowNumber});
{grid.Object}.setValue('G',fn,-1,val);
{grid.Object}.setSelectedRow(-1); *I thought this would select the first 'New Row'
{grid.Object}.setFocus(-1); * or this
Comment