Recent

Author Topic: VirtualDbGrid Can i do some thing like that  (Read 17911 times)

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #15 on: December 14, 2021, 04:24:17 pm »
Ok for some reason i need to put viewfield at property, now don't send me error, let me continue working with that and understand better.... 

Thanks for your help and time...



wp

  • Hero Member
  • *****
  • Posts: 11912
Re: VirtualDbGrid Can i do some thing like that
« Reply #16 on: December 14, 2021, 06:42:14 pm »
After work with your example witch help me great, i made some change on my tables for get work like your example i have some questions...

Look attachs screen in your example you create field text1 and write 0,1  as reference of record is top node but sql table take values from table we have de information there, so i need to change information of node to display information as must be from table....

or i have to create a virtual table from sql database and write the information on virtual table as must be show...

you can see all groups has same value in listviewfield....but you open  node you see information is litte different in my case i use category and parentid field...
Please prepare a simplified project in which I can see the issue - there are so many possibilities... And please put the database into some simple format to simplify my work.

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #17 on: December 15, 2021, 03:31:23 am »
Here sample

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: VirtualDbGrid Can i do some thing like that
« Reply #18 on: December 15, 2021, 10:20:06 am »
I asked you to provide the database in a simple format since I don't want to spend my day setting up MySQL on my computer. Please convert the sample to sqlite3.

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #19 on: December 15, 2021, 07:29:04 pm »
Ok i made change to sqlte3 here database

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #20 on: December 15, 2021, 07:33:24 pm »
here sample app change to sqlite 3 database is on previous post...

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: VirtualDbGrid Can i do some thing like that
« Reply #21 on: December 15, 2021, 11:47:42 pm »
I think that there is a misunderstanding in the meaning of IDs and ParentIDs. In your table, IDs (field "itemid", misspelled as "ietmid") begin at 1 and run up to the highest record. The parentIDs (field "cateid") start at 1, too, and run up to some value. This means that there is a overlap of ID and ParentID values. The problem is that this does not create the correct child-parent relationship.

Suppose you have a table listing plants and animals. Each record has an ID value and, of course, the name of the plant or animal. Just a few elements:
Code: [Select]
  ID   Name
  1   dog
  2   flower
  3   cat
  4   tree
Suppose you want to display these items in a tree and classify them as "plant" or "animal". In order to do this you add the items "plant" and "animal" to the table, give them the next ids (5 for "plant", 6 for "animal"). And you add another column with the ParentID. This is either 5, when the record lists a plant, or 6, when the record lists an animal. So, the table finally is
Code: [Select]
  ID   ParentID  Name
  1      6       dog
  2      5       flower
  3      6       cat
  4      5       tree
  5      0       plant
  6      0       animal
The 0 assigned to the ParentID of the "plant" and "animal" items indicates that these are top-level node attached directly to the root of the tree.

I attempted to restructure the table so that it follows this principle. The basic idea is to add new items for the category nodes. In order to have IDs for them which do not overlap with the existing IDs I replaced the current "cateid" values by their negatives:

Code: [Select]
UPDATE StockParts SET cateid=-cateid
Then I added the category nodes - since there are only a few categories I did this manually using "SQLite Expert Personal", but you certainly can find an SQL instruction to do this in a program. The records with the forder cateid=6, now with cateid=-6, have category="PS". In order to put all these record below the common "PS" node I added a new record with "category"="PS", "itemid"=-6 and "cateid"=0. The latter means: this is a top level node. "itemid=-6" means: all records will become child nodes of it. This was repeated for the other categories.

I know, it is a bit hard to explain...

The final database file is attached.
« Last Edit: December 15, 2021, 11:50:20 pm by wp »

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #22 on: December 16, 2021, 01:26:24 am »
Ok  Thanks, First information not was generated think of tree, was created like that , let me make changes as your sad, I think the best way is create a memory table  to show it right way..... Thanks so much for help and time....


eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #23 on: December 17, 2021, 05:04:40 pm »
Working fine another question how i can select a column or put the cursor there, cursor is only at row but don't go to columns....

Only field viewfilename

not navigate for columns row...

is like that or there a way to navigate for cells.


thanks
 

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: VirtualDbGrid Can i do some thing like that
« Reply #24 on: December 18, 2021, 05:00:19 pm »
When you activate the following options the virtual tree behaves more like a grid:
  • TreeOptions.MiscOptions: toGridExtensions
  • TreeOptions.SelectionOptions: toExtendedFocus

eldonfsr

  • Sr. Member
  • ****
  • Posts: 447
Re: VirtualDbGrid Can i do some thing like that
« Reply #25 on: December 22, 2021, 01:54:45 am »
Ok Thanks for help....

 

TinyPortal © 2005-2018