cancel
Showing results for 
Search instead for 
Did you mean: 

I need to add the row selection event through javascript

Former Member
0 Kudos

Can you please send the code for adding row selection event for grid through javascript .

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

Applet events need to be declared in the html, not afterwards with javascript.

Add the following in your html applet definition for the iGrid (assumes name of iGrid is 'SampleGrid'):

<PARAM NAME="SelectionEvent" VALUE="SampleGrid_Selected">

Then in a javascript block add the function using the name in the VALUE portion and as Mike mentioned, the script assistant and help docs will show you other accessor methods commonly used with the selection event in the iGrid.

Regards,

Jeremy

P.S. - I tried posting the function but it wouldn't allow me to post it, even as code...

Former Member
0 Kudos

It is ok but i need to add selection event dynamically in javascript.like using setparam property .

agentry_src
Active Contributor
0 Kudos

A selection event happens when a user clicks on a row or cell in a grid (or other applet object). This will set the selected property to the selected row or cell.

You can select a row programmatically as I mentioned above. Or you can use several other properties which are identified in the script assistant which I detailed access to.

I do not understand what you are trying to do, so if you could provide more or better detail of your goal, I or others can probably assist you better.

Regards,

Mike

Former Member
0 Kudos

I am giving the code below for instance.

function rowSelect()

{ document.appname.setQueryTemplate("empQuery");

document.appname.setDisplayTemplate("empGrid");

appname.getQueryObject.setParam(1,'raju');

here i need to add selection event for grid how do i do this please help me

appname.refresh();

}

agentry_src
Active Contributor
0 Kudos

document.appname.getGridObject().setSelectedRow(int)

Regards,

Mike

Former Member
0 Kudos

Doesn't look like you can set the event through javascript.

An alternative might be to have a global variable of what function you want to call and then executing that function in a common selection event function.

var selectionFunction = "Func1()";

function initializeGrid()
{
  applet.setQueryTemplate("path to template");

  selectionFunction = "Func2(\'Param1\')";

  applet.refresh();
}

function grid1Selected()
{
  eval(selectionFunction); 
}

This would give you a little more flexability since you can set parameters in the calling function.

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

getGridObject().setAllowSelection(boolean) to turn on Selection event functionality.

getGridObject().setSelectedRow(int) to assign a row to show as selected.

Regards,

Mike

NOTE: If you are working in 12.1 these methods are easily looked up in the workbench.

Open the workbench, open or create a web page.

At the bottom center of the window containing the webpage you will see a series of dots (5).

Click and hold and drag upward. This opens the script assistant.

I will leave it to you to explore its features.