Alpha Video Training
Results 1 to 5 of 5

Thread: OnGridPartRender event does not fire the first time grid is run

  1. #1
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default OnGridPartRender event does not fire the first time grid is run

    Shouldn't the OnGridPartRenderEvent fire on the first time the grid is run? It runs on subsequent callbacks.

    Edit. it does fire. It seems that I have a timing issue with what I am trying to do.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

  2. #2
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: OnGridPartRender event does not fire the first time grid is run

    This is what I am attempting to do.
    I have a grid that has a Rows per page selector and navigation buttons. I would like to hide the rows per page selector when there is only one page. Just like the navigation buttons are hidden when you select the hide navigation buttons when only one page property is selected. I have spent quite a few hours trying to solve this. This is what I have come up with so far. When the grid is first rendered it shows 'undefined' where the row selector should be. It works when I change to another page.

    In the OnGridPartRender event. I used this event because this is the only place I can find the page count. I have searched and cannot find the page count in javascript.
    Code:
    if e.rtc.PageCount > 1
    	dim js as c
    	dim ar as p
    	
    	ar.tdShowRowsPerGrid = <<%html%
    	<select A5HarvestIgnore="true" id="GRID1_ROWSPERPAGE_SIDE"  
    		class="GrBlueEdit"  
    		onchange="{grid.object}.setRowsPerPage($gvs(this))" title="Rows per page...">
    		<option value="10" selected="selected">10</option>
    		<option value="20">20</option>
    		<option value="25">25</option>
    		<option value="50">50</option>
    		<option value="75">75</option>
    		<option value="100">100</option>
    		</select> %html%
    	
    	dim json as c
    	json = vartojson(ar,.f.,.t.)
    	js="{grid.object}.setStateInfo(" + json + ");"
    	e.rtc.A_AjaxResponses[].text = js
    	e.rtc.A_AjaxResponses[..].id = 1
    else
    	
    	dim js as c
    	dim ar as p
    	
    	ar.tdShowRowsPerGrid = <<%html%
    		&nbsp; %html%
    	
    	dim json as c
    	json = vartojson(ar,.f.,.t.)
    	js="{grid.object}.setStateInfo(" + json + ");"
    	e.rtc.A_AjaxResponses[].text = js
    	e.rtc.A_AjaxResponses[..].id = 1
    	
    end if
    In the onGridRender client side event I have this code. I have a td tag I have set the id to 'testtd' in the Grid Toolbar Template.
    Code:
    var vShowRowsPerPage = this.stateInfo.tdShowRowsPerGrid;
    $('testtd').innerHTML = vShowRowsPerPage;
    If I click the page next navigation button and change the page the selector box shows and work OK. It just does not show on the first run of the grid. It works OK if there is only one page 'undefined' does not show. If anyone can help me on this one I would really appreciate a boost. Maybe there is an easier way.
    Last edited by frankbicknell; 05-02-2012 at 10:20 AM.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

  3. #3
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: OnGridPartRender event does not fire the first time grid is run

    I have abandoned this approach for now. I am just showing and hiding a div in the grid toolbar by hard coding the rows per page number.
    In the onGridRender client side event
    Code:
    var vTotalRowsInGrid = {grid.Object}._totalRecordsInGrid;
    if (vTotalRowsInGrid > 10)
    	{
    		$('RowsPerPageSelectorDiv').style.display = 'block';
    	}
    else
    	{
    		$('RowsPerPageSelectorDiv').style.display = 'none';
    	}
    Question. Is there a way to reclaim the space that is still used even thought the div is hidden?
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,577

    Default Re: OnGridPartRender event does not fire the first time grid is run

    According to w3schools, display='none' should not take up any space. Is there another section outside the one you're hiding that has the space?

    http://www.w3schools.com/css/css_display_visibility.asp

  5. #5
    "Certified" Alphaholic
    Real Name
    Frank Bicknell
    Join Date
    Feb 2010
    Location
    39.1915° N, 84.4348° W
    Posts
    2,467

    Default Re: OnGridPartRender event does not fire the first time grid is run

    Thank you David. I did have a TD tag that just had an '&nbsp;' and that was apparently causing it. W3Schools is a great resource.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

Similar Threads

  1. How to fire field's lookup grid or open popup grid on new record event?
    By eritovs in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 11-03-2010, 11:35 AM
  2. AfterValidate Event Won't Fire
    By Easy Rider in forum Application Server Version 9 - Web/Browser Applications
    Replies: 1
    Last Post: 10-26-2008, 06:43 AM
  3. Button event won't fire
    By Alan Anthony in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-14-2003, 12:23 PM
  4. OnKey event doesn't fire.with subform
    By Hasan Muhammad in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-20-2003, 09:42 AM
  5. ONKEY event for a form does not fire
    By Willard in forum Alpha Five Version 4
    Replies: 14
    Last Post: 02-28-2001, 05:31 AM

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
  •