|
<< Click to Display Table of Contents >> Navigation: Telegram > 2020 > 05 > 23 > Telegram_2020-05-23T09 |
2020-05-23T09:01:53
Does anyone know how to return a KeyValue by clicking on a record displayed by DataTable in IWGrid ?
2020-05-23T09:04:46
What you have to do is to set the cell to Clickable when you load it with data, as in:
2020-05-23T09:05:04
MyGrid.Cell[Row, Col].Clickable := True;
2020-05-23T09:05:25
You also put the key value in the Cell by using the Tag property:
2020-05-23T09:05:42
MyGrid.Cell[Row, Col].Tag := TObject(123);
2020-05-23T09:06:45
You need to change your mindset when you work with grids of data in a web browser
2020-05-23T09:07:13
In the VCL, you simply read the Field value of the current record (the grid automatically syncs the current record in your dataset)
2020-05-23T09:08:14
But in a browser, a standard practice is to make one of the columns clickable, and to embed the key values in the cells of that column
2020-05-23T09:08:51
From the click event you can show a popup menu with all the things you want your users to be able to do a single record
2020-05-23T09:09:07
Some people put the clickable column as the first column in the grid
2020-05-23T09:09:10
Others put it at the end
2020-05-23T09:09:13
My trouble is I use the same IWGrid for different Datasets returned they all do have same fields order
2020-05-23T09:09:39
It's not a problem
2020-05-23T09:09:56
Maybe putting it as first column
2020-05-23T09:09:58
with TIWGrid, you have to have code to load the data
2020-05-23T09:10:23
and in your \ID column\ you can also embed information as to which dataset the record is from
2020-05-23T09:10:37
Usually in Delphi the Tag property is an Integer or NativeInt
2020-05-23T09:10:37
Loren on this one can you elaborate please?
2020-05-23T09:10:51
But in TIWGrid — it is a TObject
2020-05-23T09:11:16
Thus if you want to store an Integer in the Tag property, you have to fake Delphi out and tell Delphi that your Integer is really a TObject
2020-05-23T09:11:27
123 is just an example?
2020-05-23T09:11:29
and so Delphi will think it's simply a pointer to your object
2020-05-23T09:11:36
Yes, 123 represents any Integer
2020-05-23T09:11:58
So when you read it back, you have to fake Delphi out again and tell Delphi that it's really an Integer:
2020-05-23T09:12:20
MyIntVariable := Integer(MyGrid.Cell[Row, Col].Tag);
2020-05-23T09:13:22
Ok I will try. Does Intraweb support modal form?
2020-05-23T09:13:27
If you need to embed more stuff in that cell — you can use the Hint property to store string data (but make sure that ShowHint is set to False)
2020-05-23T09:13:42
Ok
2020-05-23T09:14:02
And since Tag is a TObject, you could use that to store anything — but then you have to worry about creating and disposing of your objects
2020-05-23T09:15:03
What I want to do is clicking on a cell to return an Id of a record like adding comments to a specific topic
2020-05-23T09:15:19
Ok
2020-05-23T09:15:24
Thanks
2020-05-23T09:16:25
You must use the OnCellClick of the IWGrid to get your ID
2020-05-23T09:16:49
The OnCellClick gives you the column and the row
2020-05-23T09:17:07
Oh that’s it!
2020-05-23T09:17:12
So to get the ID, just do:
2020-05-23T09:17:34
TheID := Integer(MyGrid.Cell[ARow, AColumn].Tag);
2020-05-23T09:18:06
I will try thanks Loren
2020-05-23T09:18:11
welcome
2020-05-23T09:29:27
Fascinated to have this for my application. Lots of calculations in OnRender! Would it slow my page when loading?
2020-05-23T09:30:19
This page looks classic and exotic
2020-05-23T09:30:51
I like it for my next App that is a collaboration tool
2020-05-23T09:31:18
The code to draw executes extremely quickly
2020-05-23T09:31:39
You can do tons of complicated drawing, and you won't even notice any difference in how fast your pages are delivered
2020-05-23T09:32:02
Good news I will try
2020-05-23T09:32:34
But these days you usually get the most bang for your buck by using the HTML5 canvas, and using the vector drawing capabilities that it offers
2020-05-23T09:34:18
Loren to be honest I have learned lots on this site; I am an old fashion man but still enjoy coding. I am nearly 60
2020-05-23T09:35:00
So tend to stick with Intraweb
2020-05-23T09:35:36
But I can still learn but so far my Intraweb Apps are solid
2020-05-23T09:36:11
IntraWeb is fantastic — it offers features still not offered by other platforms
2020-05-23T09:36:32
And when I suggest using the HTML5 canvas — I am proposing that you do that in your IW app
2020-05-23T09:37:26
If you use TIWText component and set RawText to True — you can put whatever HTML5 content in there — and IW will not try to psychoanalyze it — it just passes it straight through to your page
2020-05-23T09:37:31
It's EXTREMELY useful!
2020-05-23T09:37:57
Yes I know and you have been very helpful and I can tell that I have enjoyed being on this app
2020-05-23T09:38:02
It's allows you to use all kinds of modern widgets
2020-05-23T09:38:17
May I ask — what language is \Sokel\ from?
2020-05-23T09:38:31
I'm a linguist by trade))
2020-05-23T09:39:26
Sokel is my name and I am from Congo; currently I am in USA
2020-05-23T09:39:31
Wow!
2020-05-23T09:39:38
Do you know Lingala or Kikongo?
2020-05-23T09:39:59
Yes of course!
2020-05-23T09:40:19
Don’t telling me I know you?
2020-05-23T09:40:36
I am looking for a few simple translations for those languages, so if you ever have a few moments, I could use some help :)
2020-05-23T09:42:35
Lingala yes but kikongo I just understand a bit. Remember we have 4 national languages and I speak 3.
2020-05-23T09:43:02
amazing
2020-05-23T09:43:15
I lived in South Africa for a while, and I learned some Zulu
2020-05-23T09:43:30
You are welcome for lingala.
2020-05-23T09:43:37
And I have recently started studying Zulu again with a tutor
2020-05-23T09:43:50
Well, we should take this discussion away from this chat))
2020-05-23T09:44:04
South Africa? I have been living there since 1991
2020-05-23T09:44:11
wow!
2020-05-23T09:44:23
Johannesburg NorthCliff
2020-05-23T09:44:52
I lived in Yeoville and Roodeport
2020-05-23T09:44:57
My tutor is from eThekwini
2020-05-23T09:45:39
That’s wonderful! You are welcome Loren
2020-05-23T09:46:03
Let's try to make a chat outside of this chat
2020-05-23T09:46:51
I am working on a project for my gov and if it is ok I might get in touch with you. There is lots to do
2020-05-23T09:47:01
Ok
2020-05-23T09:47:53
12076180887 WhatsApp
2020-05-23T09:47:54
Roger that
2020-05-23T09:56:03
Hello friends!
Can I receive read receipt of email sent by indy? I know that this is an IntraWeb group, but I believe that someone can help me with this. tks