Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
jauno  
#1 Posted : Friday, January 22, 2016 4:29:53 PM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Hello everyboy!
I have an iGrid with combobox cells. I store my cell data in a database therefore I need an ID to save. I now want to let chose an item of the cell combo and make a break in the BeforeCommitEdit event of iGrid to decide whether to save the data or not. (Thanks to Igor for fixing the crash problem at this point!)
To save the data, I want to read the ID of the item stored in the itemvalue of the cell combo.
In iGrid cells I also want to show celltext which is not member of the combobox listitems, therefore I must take the igCellTextCombo as ECellType Enumeration to enable this.
But now I have the problem to retrieve the value (=ID) of the choosen item. With igCellCombo I can get the the stored itemvalue (vNewValue in BeforeCommitEdit). With igCellTextCombo however while checking vNewValue I get the itemtext once more. My problem is to get the ID in this context. Look at the code added.
OK a way out of this would be to store the ID in a variable array while setting up the combo. But I can't find the index of the variable for iGrid cell combos have no selected item property.
How can I resolve the problem?

You can download the sample project here but this works only with the new fixed iGrid >= v6.0.14 !!

lg Norbert

Edited by moderator Wednesday, March 22, 2017 2:02:31 PM(UTC)  | Reason: Igor/10Tec added implementation status

Igor/10Tec  
#2 Posted : Saturday, January 23, 2016 10:03:55 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
A good architectural question. Combo item values aren't used in BeforeCommitEdit for igCellTextCombo cells as the user can enter any text in the cell. How would you want to distinguish these two cases (selecting a combo item or entering an arbitrary string) in BeforeCommitEdit?

Tell us your vision, and perhaps, we'll implement it in the forthcoming service release of iGrid v6.

Edited by user Tuesday, January 31, 2017 9:50:21 AM(UTC)  | Reason: typo correction

jauno  
#3 Posted : Saturday, January 23, 2016 10:38:47 AM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post

Tell us your vision, and perhaps, we'll implement it int he forthcoming service release of iGrid v6.


Hello Igor. This is very simpel. The iGrid cell combo has no listindex property as the vb combo has. The listindex returns the index of the item actually selected by the user. So the user can find the itemvalue/itemtext of the selected row in the combo an can handle this for db operations and so on. Actually this is not possible.

Igor/10Tec  
#4 Posted : Monday, January 25, 2016 1:18:04 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
Why not possible? Your task is to find the combo item that has the item text equal to the text entered by the user, right? The ComboObject provides you with the indexed ItemText property that returns the text of the combo item with the specified index. You just need to enumerate all combo items using a loop from 1 to ListCount and find the corresponding item by querying the ItemText property for each item.
jauno  
#5 Posted : Monday, January 25, 2016 4:31:36 PM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post
Why not possible? Your task is to find the combo item that has the item text equal to the text entered by the user, right? The ComboObject provides you with the indexed ItemText property that returns the text of the combo item with the specified index. You just need to enumerate all combo items using a loop from 1 to ListCount and find the corresponding item by querying the ItemText property for each item.


No that is not what I mean. My task is to find the index of the combo item selected or clicked by the user. Sure, I can capture the Itemtext in the BeforeCommitEdit event. But it could happen in theory that the ItemText is not unique. So this is not usable for database operations. Therefore I need an unique ItemValue as a second data which can also be stored as a property. OK so far. As I posted earlier I get both values when I interrupt in BeforeCommitEdit and celltype=igCellCombo. But as I want also to store data in the cell which are not equal with one of the combo items I must use celltype=igCellTextCombo to see all cell values. But then I have no chance to get the combo value.


Igor/10Tec  
#6 Posted : Tuesday, January 26, 2016 9:28:08 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
Yes, now I see this "theoretical" problem - you may have the same text for different combo list items. Can I ask you just one question regarding this? How will your users distinguish items with the same text then?

Ok, in any case, I think your suggestion regarding the ability to retrieve the index of the selected combo list item in BeforeCommitEdit makes sense. I will think about adding this in the future releases.

Meanwhile, I've implemented a special tool based on the DevDbg method of iGrid that allows you to retrieve the value you need. The link to the interim build of iGrid with this tool is already in your mailbox.
Igor/10Tec  
#7 Posted : Tuesday, January 26, 2016 9:30:48 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
One more question regarding the vNewValue parameter of BeforeCommitEdit. Do you find it right that this parameter contains the same text that will be stored as the cell text? Frankly speaking, I had not found another good candidate for this parameter value while working on iGrid v6.
jauno  
#8 Posted : Tuesday, January 26, 2016 7:00:00 PM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post
One more question regarding the vNewValue parameter of BeforeCommitEdit. Do you find it right that this parameter contains the same text that will be stored as the cell text? Frankly speaking, I had not found another good candidate for this parameter value while working on iGrid v6.


I am a database programmer. Therefore I meanly think in those categories.
For database operations we distinguish between IDs (unique identifier to find and save the record in the db) an text (a description of the record which must not absolutely be unique). To save and restore a value from a combo to/from a db so it is essential to know the ID of the record. Therefore I think it is necessary to enable access to both properties in all circumstances.

Edited by user Tuesday, January 26, 2016 7:02:08 PM(UTC)  | Reason: Not specified

jauno  
#9 Posted : Tuesday, January 26, 2016 7:15:46 PM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post
Yes, now I see this "theoretical" problem - you may have the same text for different combo list items. Can I ask you just one question regarding this? How will your users distinguish items with the same text then?

That could be realized by storing unique identifiers in the value property of the combo.

Originally Posted by: Igor/10Tec Go to Quoted Post
Ok, in any case, I think your suggestion regarding the ability to retrieve the index of the selected combo list item in BeforeCommitEdit makes sense. I will think about adding this in the future releases.

Would be great! By the way: the MS combo and all other ones (3rd party) offer this option with its listindex property!

Originally Posted by: Igor/10Tec Go to Quoted Post
Meanwhile, I've implemented a special tool based on the DevDbg method of iGrid that allows you to retrieve the value you need. The link to the interim build of iGrid with this tool is already in your mailbox.


I'll look at it and report. And thanks a lot Igor for your extraordinary work for the iGrid users.

Edited by user Tuesday, January 26, 2016 8:06:46 PM(UTC)  | Reason: Not specified

jauno  
#10 Posted : Tuesday, January 26, 2016 9:19:15 PM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post

Meanwhile, I've implemented a special tool based on the DevDbg method of iGrid that allows you to retrieve the value you need. The link to the interim build of iGrid with this tool is already in your mailbox.

I tested it. It works. This is the answer to the problem to find out the combo item selected by the user. Thanks Igor.

Edited by user Tuesday, January 26, 2016 9:25:31 PM(UTC)  | Reason: Not specified

Igor/10Tec  
#11 Posted : Wednesday, January 27, 2016 8:00:01 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
Originally Posted by: jauno Go to Quoted Post
By the way: the MS combo and all other ones (3rd party) offer this option with its listindex property!


Yes, but there is one "small" problem. You are talking about the form controls, but in iGrid a ComboObject is an invisible object shared among many cells. ListIndex makes sense if you create an instance of the control on a form and the user selects 1 item in it, but in iGrid each cell with the same combo may have different ListIndex. In fact, we are talking more about a cell property.
jauno  
#12 Posted : Wednesday, January 27, 2016 8:51:14 PM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post
Originally Posted by: jauno Go to Quoted Post
By the way: the MS combo and all other ones (3rd party) offer this option with its listindex property!


Yes, but there is one "small" problem. You are talking about the form controls, but in iGrid a ComboObject is an invisible object shared among many cells. ListIndex makes sense if you create an instance of the control on a form and the user selects 1 item in it, but in iGrid each cell with the same combo may have different ListIndex. In fact, we are talking more about a cell property.


I think the devdbg solution is sufficient enough to find the selected item. Will this be implemented in a sort of object property within the next major revision of iGrid?

Igor/10Tec  
#13 Posted : Thursday, January 28, 2016 9:06:50 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
My first idea was to pass this ListIndex value as a new parameter of the BeforeCommitEdit event.

An alternative solution can be implementing this as a cell property - say, CellComboListIndex(<row>, <col>). It could cache (store) the listindex of the selected combo item the last time, so you could retrieve this value at any time - not only in BeforeCommitEdit.

What is your opinion?
jauno  
#14 Posted : Thursday, January 28, 2016 11:17:21 AM(UTC)
jauno

Rank: Member

Groups: Registered
Joined: 10/22/2015(UTC)
Posts: 27
Location: Alsace, France

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Igor/10Tec Go to Quoted Post
My first idea was to pass this ListIndex value as a new parameter of the BeforeCommitEdit event.

An alternative solution can be implementing this as a cell property - say, CellComboListIndex(<row>, <col>). It could cache (store) the listindex of the selected combo item the last time, so you could retrieve this value at any time - not only in BeforeCommitEdit.

What is your opinion?


I think the second solution would give more flexiblity to the programmer.
Igor/10Tec  
#15 Posted : Friday, January 29, 2016 10:16:05 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
Ok, I have added this suggestion to the to-do list for the future releases.
thanks 1 user thanked Igor/10Tec for this useful post.
jauno on 1/29/2016(UTC)
Igor/10Tec  
#16 Posted : Wednesday, March 22, 2017 1:52:30 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,114

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
We have built this functionality into iGrid 6.5 released today. First, the BeforeCommitEdit event was supplemented with the new parameter named lComboListIndex - it contains the index of the selected combo list item. Second, you can read the index of the combo list item selected in a cell after editing using the new CellComboListIndex property.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.