|
#1
|
||||
|
||||
|
Datagrid Issue
I hit a weird issue with the datagrid. I am saving the data to a MySQL database (with Ulrich's fantastic plugin). I am getting the grid data and saving it to the database with
Code:
sCurrentRows = Grid.GetRowCount("Grid1");
sCurrentRows = sCurrentRows-1;
local sSelTable = ComboBox.GetItemData("ComboBox1", ComboBox.GetSelected("ComboBox1"));
MySQL.Query("DROP TABLE "..sSelTable);
MySQL.Query("DROP FROM settings WHERE ID = '"..sSelTable.."'");
MySQL.Query("CREATE TABLE "..sSelTable.."(title VARCHAR( 100 ) NOT NULL ,weight VARCHAR( 30 ) NOT NULL ,buy VARCHAR( 100 ) NOT NULL ,sell VARCHAR( 100 ) NOT NULL )");
for t=1,sCurrentRows do
rowTitle=Grid.GetCellText("Grid1", t, 0)
rowWeight=Grid.GetCellText("Grid1", t, 1)
rowBuy=Grid.GetCellText("Grid1", t, 2)
rowSell=Grid.GetCellText("Grid1", t, 3)
MySQL.Query("INSERT INTO "..sSelTable.." VALUES('"..rowTitle.."','"..rowWeight.."','"..rowBuy.."','"..rowSell.."')");
end
LoadGrid();
Dialog.Message("Done", "Settings Saved", MB_OK)
__________________
User error: replace user and press any key to continue. Last edited by Scriptonite; 2 Weeks Ago at 10:41 PM. |
|
#2
|
|||
|
|||
|
The grid row index is zero based but you are starting at 1. Perhaps that is the problem.
__________________
Dermot AMS Add-ons - xDialog.com A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine. |
|
#3
|
||||
|
||||
|
I started it at 1 because 0 is a fixed row. I also just discovered the cell data won't save from anywhere on the grid if I don't click off of it before I try to save. It can be in the middle of a row or the end. It's like the grid wants a SetUpdateCell function. How can I tell the grid the cell is updated and the cell data should be set. I've tried the set text and refresh with no luck.
__________________
User error: replace user and press any key to continue. |
|
#4
|
||||
|
||||
|
Solved the issue. It seems that the grid needs to lose focus entirely to update the data. It started working correctly after I added the status dialog before the save function.
__________________
User error: replace user and press any key to continue. |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
All times are GMT -6. The time now is 08:46 AM.








Linear Mode
