Page 1 of 1

DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 9:46 am
by NigelS
Greetings

I'm in a fix. For some reason, maybe old age, I cannot get my head around the datagrid. The result I'm trying to achieve is to have a datagrid with two columns. The curved ball in this is the second column. In some instances it'll have a check box and in other instances it'll have a text displayed. See examples I've attached to this post. I've been at this for the last month and still cant get it right.

I've searched high and low for some sort of example but with not much success.

Can any of our esteemed LC gurus please give me some guidance on this and in return I will open my source code on how it was accomplished.

The attachment "My attempt" is what I'm trying to achieve.

Regards
Nigel

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 11:36 am
by Klaus
Hi Nigel,

sorry, but what exactly is your question?

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 12:08 pm
by NigelS
How do I mix object types in the second column. In the attached screen dumbs the second column has different objects. How do I achieve this? I'm using the data grid as a the object

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 12:12 pm
by Klaus
Hi Nigel,

ah, OK, I see :-)
Your datagrid will need to be of type FORM for this!

On the other hand, this does not look like a job for a datagrid but for a carefully layed out group!?


Best

Klaus

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 1:11 pm
by NigelS
That was my first option, unfortunately this "Property Detail" differs in it's structure which is dependant on what the user has selected on a previous card. In the PHP version of this "Property Details" is built up dynamically and I'm trying to do the same. The details of which are retrieved from a database table. I'm lacking in-depth knowledge of LC only having started with it about a year ago and I only get to play with it over the weekend's.

Any other idea's would be welcomed, bearing in mind that these objects would have to be created dynamically, also this application will be running on a iPad.

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 1:25 pm
by Klaus
Hi Nigel,

no idea how your data will be organized, but I would eventually create a group with ALL possible options
and then check the incoming data and show/hide all (un-)neccessary options. Know what I mean?


Best

Klaus

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 1:26 pm
by NigelS
For those interest this is the process :-

//Retrieve the data from the database

Code: Select all

function populatePropertyDetail pPropertySubType
   
   local tSqlQuery, tConnectionID, tSqlResult, tFunctionFailed 
   
   put false into tFunctionFailed
   put empty into lgPropertyDetailList
   put empty into lgPropertyDetailArray
   
   if GetDataBaseID() is empty then
      openDatabase GetPlatformDesc()
   end if 
   
   put GetDataBaseID() into tConnectionID
   
   put "SELECT pd2st.propSubTypeID, pdt.datatype, pd.* " & \ 
         "FROM propertydetail pd " & \ 
         "JOIN propdetail2propsubtype pd2st ON pd.ID = pd2st.propDetailID " & \ 
         "JOIN propertydetailstype pdt ON pdt.ID = pd.propDetailsType " & \ 
         "WHERE pd2st.propSubTypeID = " & pPropertySubType & \
         " AND active = 1" & \
         " ORDER BY pd.orderno " into tSqlQuery
   
   put revQueryDatabase( tConnectionId, tSqlQuery) into tSqlResult
   if tSqlResult is an integer then
      ConvertSQLResultToArray tSqlResult, lgPropertyDetailArray 
      revCloseCursor tSqlResult
   else
      put true into tFunctionFailed
   end if
   
   closeDatabase
   
   return tFunctionFailed
   
end populatePropertyDetail 
In the end of all the processing an array with the following details is made available to build the data grid

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 1:30 pm
by NigelS
So what your saying Klaus is to create a group with ALL the data entry properties that is possibly going to be used and then when the user makes the selection hide/unhide those objects that are required as per user request, inside the group?

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 1:47 pm
by Klaus
Yes! But this is a quick shot without knowing any detail :-)

Re: DataGrid Help... @#$%&^**

Posted: Sun Jul 07, 2013 3:53 pm
by NigelS
what details would that be?

Re: DataGrid Help... @#$%&^**

Posted: Mon Jul 08, 2013 11:23 am
by Klaus
Every detail! :-D

No I think I would do it the way I decsribed above, one group with ALL possible options
(depends on how many options there will be) and show/hide them according to the incoming data.


Best

Klaus

Re: DataGrid Help... @#$%&^**

Posted: Mon Jul 08, 2013 7:31 pm
by NigelS
I will pursue that way.