Alpha Video Training
Results 1 to 12 of 12

Thread: after search event

  1. #1
    Member
    Real Name
    ken tjia
    Join Date
    Jan 2008
    Location
    Vancouver, BC Canada
    Posts
    560

    Default after search event

    I am testing with a simple read only grid.
    with a single search field (exact match)

    and once we enter the part number and hit submit or simply hit enter, i have the result display perfectly.

    would would be the guidance to do :
    * first have the cursor activate on this search field (on the grid)
    * second, after submit, i want code to clear the entered search string info, like search_data = ''
    and want the cursor to be activate on the search field again.
    and ready for the next entry....

    more like next search...

    I have it to work on testing, however
    currently i have to move the cursor back to the search field
    and clear the entry with keyboard & mouse.

    this is in fact a very simple request, unfortunately i am
    not able to do it myself, appreciate your assistance,
    i trust there are many who want to see how this is done..

    T H A N K S

    Ken Tjia

  2. #2
    Member
    Real Name
    David Mildenhall
    Join Date
    Jul 2009
    Location
    Reading, UK
    Posts
    235

    Default Re: after search event

    Try the following:

    1) Put the following code in the onSearchRender event under Grid Properties, Javascript - System Events

    Code:
    var e = $('{Grid.ComponentName}.S.PARTNUMBER');
    e.focus();
    2) Put the following code in the afterSearchSubmit event

    Code:
    {grid.Object}.setValue('S','PARTNUMBER','');
    
    var e = $('{Grid.ComponentName}.S.PARTNUMBER');
    e.focus();
    Hope it helps.

  3. #3
    Member
    Real Name
    ken tjia
    Join Date
    Jan 2008
    Location
    Vancouver, BC Canada
    Posts
    560

    Default Re: after search event

    Hi David,
    T H A N K S you so much for such submission,
    i know just how simple it is, however unable to find it.

    I got it to work perfectly, and i will produce a live prototype
    for the public to see what i attempt to do.

    it work so well.......

    that lead me to two questions related in a way...

    my search to be exact match only, to my strange discovery,
    when the search value = '' blank...

    the grid will produce record 1....

    on do i apply code in "before search event"

    is it as simple as if :

    {grid.Object}.setValue('S','PARTNUMBER',''); = '' ???????
    then stop ?? how do we apply such conditional event?

  4. #4
    Member
    Real Name
    ken tjia
    Join Date
    Jan 2008
    Location
    Vancouver, BC Canada
    Posts
    560

    Default Re: after search event

    this is what i want it to do...
    CanSearchSubmit event... obviously not right!

    var val1 = $('{grid.componentname}.S.REQUEST_ID').value;

    if val1 = ''
    {grid.Object}.setValue('S','REQUEST_ID','r');
    end if

  5. #5
    Member
    Real Name
    David Mildenhall
    Join Date
    Jul 2009
    Location
    Reading, UK
    Posts
    235

    Default Re: after search event

    This need a slightly different approach

    You need to use the main CanSearch event. (see attached). You need to alter the code if you want to display a message.


    Just one other point if you have Clear Search enabled you may need to add some of the previous code to the afterSearchClear event under grid properties so that the cursor shows where you want it.

  6. #6
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: after search event

    Quote Originally Posted by DBM View Post
    var e = $('{Grid.ComponentName}.S.PARTNUMBER');
    e.focus();
    How do I get that to work in the context of a grid? This grid has but a single row.

  7. #7
    Member
    Real Name
    David Mildenhall
    Join Date
    Jul 2009
    Location
    Reading, UK
    Posts
    235

    Default Re: after search event

    Peter,

    Try this in the OnGridRender event


    Code:
    var rowNumber = {grid.object}._selectedRow;
    var ele = $('{grid.componentname}.V.R' + rowNumber + '.NAMEOFFIELDTOGETFOCUS');
    ele.focus();
    David.

  8. #8
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: after search event

    Way cool, David. Thanks

  9. #9
    Member
    Real Name
    ken tjia
    Join Date
    Jan 2008
    Location
    Vancouver, BC Canada
    Posts
    560

    Default Re: after search event

    Hi Peter,
    hope the community is getting better on focusing of various kind...

    i have a parent grid with linked-grid (classified as being child grid)
    on parent's row change, i would like the cursor to focused on one of
    child's field.

    Hate to say, my child grid is a new record entry grid (not sure the legality)
    it has been working, i just want the cursor to go there.
    the field name in this case is a remark_entry field

    Currently, i manually have to move it there with a mouse.

    Ken Tjia

  10. #10
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: after search event

    Ken,

    Haven't tied this, so not sure if the syntax is correct:

    Code:
    var co = $('{Grid.ChildObject}.V.R1' + '.NAMEOFFIELDTOGETFOCUS');
    co.focus();

  11. #11
    Member
    Real Name
    ken tjia
    Join Date
    Jan 2008
    Location
    Vancouver, BC Canada
    Posts
    560

    Default Re: after search event

    Hi Peter,
    The linked girds has several child.
    Firebug gives me this property ?
    you know, it is constantly changing ?

    <textarea style="font-size: 11pt;" rows="3" cols="80" id="TECH_WORK_ORDER_LCS_NEWJOURNAL_WO_JOURNAL_ENTRY_RNSF_P1.V.R-1.REMARK" class="PerforatedTextarea" name="V.R-1.REMARK"></textarea>

    i presume, i am working along these ?

    TECH_WORK_ORDER_LCS_NEWJOURNAL_WO_JOURNAL_ENTRY_RNSF_P1.V.R-1.REMARK

  12. #12
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: after search event

    {Grid.ChildObject} will resolve itself to the child name.

    Check this out, maybe it will help you?

    //Show Grid 2 for row 3.
    {grid.Object}.showRowExpandGrid(2,3);

Similar Threads

  1. After search event
    By joellustigman in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 11-29-2010, 02:50 PM
  2. Field Event - Record Event not firing
    By David Boomer in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 06-08-2009, 08:57 PM
  3. How do I find the Error in event handler code for OnClick event
    By Easy Rider in forum Application Server Version 9 - Web/Browser Applications
    Replies: 2
    Last Post: 08-21-2008, 11:09 PM
  4. Error in event handler code for online click event...
    By Steve Wood in forum Application Server Version 8
    Replies: 1
    Last Post: 12-15-2007, 12:28 AM
  5. Before Search event
    By gregz in forum Web Application Server v7
    Replies: 6
    Last Post: 11-03-2005, 10:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •