Functions
All functions you need to know about are explained here. This is how you call a function $_SESSION["your_grid"]->SomeFunction();
PrintGrid(integer MODE)
This is the main function that shows the whole grid. It can be used in two different ways.
PrintGrid(MODE_VIEW) will show an ordinary grid.
PrintGrid(MODE_EDIT) will show an editable grid.
SetDatabaseConnection(string database, string username, string password, string hostname="localhost")
Set the database connection parameters. The parameters are the MySQL database name, the MySQL username and password, and optionally the database hostname.
SetSqlSelect(string columns, string table, string where="")
Set the database query parameters. The columns argument specifies the fields to return, for example 'field1, field2, field3'. The table field is the name of one or more table to run the search up, for example 'table1' or 'table1, table2'. The optional where argument takes the WHERE clause of the SQL select.
SetUniqueDatabaseColumn(string id_column_name, boolean show)
Use this function to identify which column in the database that is unique. This must be done to make slGrid work in the right way. I really recommend to use auto_increment on this column, it will make it possible to add rows in edit mode.
SetImageDatabaseColumn(string column_name, optional string image_directory = "")
Deprecated - Use SetPlugin() instead.
Use this function if the database column "column_name" contains pictures (and you want to show them). You may also define a path to the images which is done by the variable "image_directory".
SetUrlImageDatabaseColumn(string column_name, boolean open_in_new_browser, string image)
Deprecated - Use SetPlugin() instead.
Use this function if the database column "column_name" contains url. The boolean "open_in_new_browser" decides if the url should be opened in a new browser. The variable "image" is a image path to the image that should represent all the rows in the current column.
SetMailAdressDatabaseColumn(string column_name)
Deprecated - Use SetPlugin() instead.
Use this function if you want the mailadresses to start a mail program on click.
SetMaxRowsEachPage(integer max_rows)
Use this function to define how many rows to be shown on each page.
SetEditModeAdd(boolean is_enabled)
Use this function on MODE_EDIT. You can decide if it should be possible to add rows. Sometimes you want to limit this possibility.
SetEditModeEdit(boolean is_enabled)
Use this function on MODE_EDIT. You can decide if it should be possible to edit a row.
SetEditModeDelete(boolean is_enabled)
Use this on MODE_EDIT. You can decide if it should be possible to delete rows.
SetShowPrintIco(boolean show_ico)
Use this function to hide/show the print image in the upper right corner.
SetStripHtmlTags(boolean strip_tags)
Use this function to decide if all database information should contain or not contain html tags. It also affects the whole edit mode. By security reasons the default is set to true.
SetWidth(integer width)
Use this function to set the width of the grid. Sometimes the grid becomes wider than the width because there is no free space left.
SetShowExcelIco(boolean show_ico)
Use this function to hide/show the excel ico.
SetTextPage(string text_page)
Use this function to translate the text "page" to your own language.
SetTextGoToPage(string text_gotopage)
Use this function to translate the text "Go to page" to your own language.
SetTextTotalRows(string text_totalrows)
Use this function to translate the the text "total rows:" to your own language.
SetTextEdit(string text_edit)
Use this function to translate the text "Edit" to your own language.
SetTextSave(string text_save)
Use this function to translate the text "Save" to your own language.
SetTextDelete(string text_delete)
Use this function to translate the text "Delete" to your own language.
SetTextAdd(string text_add)
Use this function to translate the text "Add" to your own language.
SetDatabaseColumnWidth(string column_name, integer width)
Use this function to set the width of a grid column manually. Column_name is the database column name. Width is the wanted width of the column.
SetDatabaseColumnName(string old_column_name, string new_column_name);
Use this function to change the column names to something else then the database column name. old_column_name must be the name of the database column you want to change. new_column_name is the new name that you want to show.
SetTitleName(string title)
Use this function when you want to define your own grid name. Or else it´s the database table name.
SetUrlDatabaseColumn(string column_name, optional boolean open_in_new_browser)
Deprecated - Use SetPlugin() instead.
Use this function if the database column "column_name" contains url. The boolean "open_in_new_browser" decides if the url should be opened in a new browser.