Jump to content

GridList (specially columns)


Piorun

Recommended Posts

Hi guys. Here i show you code:

addEventHandler("loadTableColumns", root, function(columnTable)  
    if #adminpanel.databasegridlist.column > 0 then 
  
        for i=1,#adminpanel.databasegridlist.column do 
            guiGridListRemoveColumn(adminpanel.databasegridlist[1], adminpanel.databasegridlist.column[i]) 
            table.remove(adminpanel.databasegridlist.column, i) 
        end 
         
    end 
     
    for _, column in ipairs(columnTable) do 
        adminpanel.databasegridlist.column[#adminpanel.databasegridlist.column+1] = guiGridListAddColumn(adminpanel.databasegridlist[1], column.name, 0.1) 
    end 
end) 

Problem is that this function "guiGridListRemoveColumn" doesnt work correctly. It remove only 2 first columns (but it returns number of removed columns correctly). columnTable is column from "PRAGMA table_info(...)" so it returns columns of database. Columns in gridlist are added fine. Help pls :D.

Link to comment

Step by step:

1. I have gridlist.

2. Using some table i want to add columns which names are same as names in this table.

3. For ex. table have 13 elements and 13 columns are added to gridlist.

4. After that i want to delete those columns from gridlist (all) - when i check (outputChatBox(tostring(guiGridListRemoveColumn...))) function corectly removing 13 columns (result - 13 times "true") but only 2 are really removed.

What's wrong (and this is this code)?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...