Created
March 10, 2011 17:20
-
-
Save walterdavis/864492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MYACTIVERECORD_CONNECTION_STR', 'mysql://yourDatabaseUserName:yourDatabasePassword@localhost/yourDatabaseName'); | |
class Widgets extends MyActiveRecord { | |
//nothing else needed here | |
} | |
$visible_columns = array(); | |
$columns = MyActiveRecord::Columns('Widgets'); | |
$out = '<table class="editable"><tr>'; //added the editable class | |
foreach($columns as $key => $column){ | |
if($key != 'id'){ | |
$out .= '<th id="' . $key . '">' . $key . '</th>'; //added column id | |
$visible_columns[] = $key; | |
} | |
} | |
$out .= '</tr>'; | |
$widgets = MyActiveRecord::FindAll('Widgets'); | |
foreach($widgets as $widget){ | |
$out .= "\n<tr id=\"row_" . $widget->id . "\">"; //added row id | |
foreach($visible_columns as $col){ | |
$out .= '<td>' . $widget->h($col) . '</td>'; | |
} | |
$out .= '</tr>'; | |
} | |
$out .= '</table>'; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
TableKit.options.editAjaxURI = 'update.php'; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment