Displaying more than 99 rows of a subfile
-
- Profound User
- Posts: 42
- Joined: Wed Aug 04, 2010 5:12 pm
- First Name: Bob
- Last Name: Steach
- Company Name: APHA
- Contact:
Displaying more than 99 rows of a subfile
I am working on an iPad application and want to display all of my subfile records. This would make the scrolling faster by flicking my finger on the iPad instead of having to use the page controls to scroll. It looks like the number of rows in the grid property is limited to 99.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Displaying more than 99 rows of a subfile
If you set the Subfile Size property on the grid to 9999 and perform a load all subfile in your program, it should work exactly how you want. I have never seen a limit of 99 rows on a grid.
-
- Profound User
- Posts: 42
- Joined: Wed Aug 04, 2010 5:12 pm
- First Name: Bob
- Last Name: Steach
- Company Name: APHA
- Contact:
Re: Displaying more than 99 rows of a subfile
I have don that and it still only displays 99 rows including the header row. I think the problem is in the grid settings ( number of rows property ). This property will not accept more than 99 as a setting.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Displaying more than 99 rows of a subfile
Hmmm. I will try to recreate this issue on our system. Unfortunately, I am going to be out this afternoon. Is this something I can work on over the weekend and answer on Monday, or do you need me to find someone else to take it?
-
- Profound User
- Posts: 42
- Joined: Wed Aug 04, 2010 5:12 pm
- First Name: Bob
- Last Name: Steach
- Company Name: APHA
- Contact:
Re: Displaying more than 99 rows of a subfile
Over the weekend will be fine. Just to let you know I am getting all of my records(164) loaded in the subfile.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Displaying more than 99 rows of a subfile
So, after spending some time looking over grids and ipad I think I understand what you are trying to accomplish. You don't want to use the scroll bar that is built in to the grid. You want the entire subfile to display so that you can use the ipad's "flick" gesture.
Simply setting the "number of rows" property to a hard coded 9999 will cause a huge grid that may be mostly empty depending on the amount of data you want to display. So you will want to be able to set the "number of rows" dynamically.
Since the property is not bindable, we will need to use a bit of JavaScript to make this happen.
1. First, define a decimal output field that your program will output the record count to. Basically, after loading your subfile, just set this field equal to your RRN field in your RPG program. You will want to place this field out of the way on the screen and then set the "visibility" property to "hidden". Make sure to make not of what the "ID" property is or set the ID to something you will remember. You will use the ID to reference this field in your JavaScript.
2. Next, you want to find the "onLoad" property for the screen. To find it, click away from any widgets on your screen and scroll to the bottom of the properties panel. In the onLoad property you will want to insert the following JavaScript code:
getObj("GridID").grid.setProperty("number of rows", get("HiddenFieldID"));
getObj("GridID").grid.sizeAllCells();
GridID is the ID property of the grid you are resizing. If there is only one grid on the screen, most likely it is set to Grid1. HiddenFieldID is the ID property of the hidden decimal field you defined in step one.
So this will allow you to dynamically control the number of rows displayed in your grid. Now for the 99 row limit. This limit is imposed in two places, the designer and the runtime. There are no plans to change the limit in the designer, but that does not affect the solution I have provided. The runtime limit, however, is a problem. In order to make this work for you, we have removed the runtime limit in order to make this solution work. This change will be available in the next update for ProfoundUI, which should publish in the next couple of weeks.
There is one think to keep in mind. This limitation was implemented because performance degrades as you add more rows to be displayed at one time. This is due to the time it takes the browser to render larger amounts of data. So, if you try to render thousands of rows at one time, your page will not perform well. Be sure to test using the maximum expected number of records.
Let me know if you have issues or questions with this solution.
Simply setting the "number of rows" property to a hard coded 9999 will cause a huge grid that may be mostly empty depending on the amount of data you want to display. So you will want to be able to set the "number of rows" dynamically.
Since the property is not bindable, we will need to use a bit of JavaScript to make this happen.
1. First, define a decimal output field that your program will output the record count to. Basically, after loading your subfile, just set this field equal to your RRN field in your RPG program. You will want to place this field out of the way on the screen and then set the "visibility" property to "hidden". Make sure to make not of what the "ID" property is or set the ID to something you will remember. You will use the ID to reference this field in your JavaScript.
2. Next, you want to find the "onLoad" property for the screen. To find it, click away from any widgets on your screen and scroll to the bottom of the properties panel. In the onLoad property you will want to insert the following JavaScript code:
getObj("GridID").grid.setProperty("number of rows", get("HiddenFieldID"));
getObj("GridID").grid.sizeAllCells();
GridID is the ID property of the grid you are resizing. If there is only one grid on the screen, most likely it is set to Grid1. HiddenFieldID is the ID property of the hidden decimal field you defined in step one.
So this will allow you to dynamically control the number of rows displayed in your grid. Now for the 99 row limit. This limit is imposed in two places, the designer and the runtime. There are no plans to change the limit in the designer, but that does not affect the solution I have provided. The runtime limit, however, is a problem. In order to make this work for you, we have removed the runtime limit in order to make this solution work. This change will be available in the next update for ProfoundUI, which should publish in the next couple of weeks.
There is one think to keep in mind. This limitation was implemented because performance degrades as you add more rows to be displayed at one time. This is due to the time it takes the browser to render larger amounts of data. So, if you try to render thousands of rows at one time, your page will not perform well. Be sure to test using the maximum expected number of records.
Let me know if you have issues or questions with this solution.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Displaying more than 99 rows of a subfile
Actually, I noticed that we are missing some styling in the grid that will require a little more js code. Give us a little time to see if we can simplify it a bit.
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Displaying more than 99 rows of a subfile
Ok, it actually took a few more lines of js to make this work. Therefore, we wrapped it all up into a custom js function to handle everything for you. in step 2 above, use this one line of js instead of the two listed
getObj("Grid1").grid.setNumberOfRows(get("Size"));
Everything else from that post still applies.
This new function and the removal of the runtime limit will be included in the 3.0.3 update that will publish soon.
getObj("Grid1").grid.setNumberOfRows(get("Size"));
Everything else from that post still applies.
This new function and the removal of the runtime limit will be included in the 3.0.3 update that will publish soon.
-
- Profound User
- Posts: 42
- Joined: Wed Aug 04, 2010 5:12 pm
- First Name: Bob
- Last Name: Steach
- Company Name: APHA
- Contact:
Re: Displaying more than 99 rows of a subfile
Thanks Brian -- you guys are the greatest.
Who is online
Users browsing this forum: No registered users and 5 guests