• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SQLite and TableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SQLite and TableView


  • Subject: Re: SQLite and TableView
  • From: Andreas Mayer <email@hidden>
  • Date: Tue, 15 Jul 2003 01:12:43 +0200

Am Dienstag, 15.07.03 um 00:44 Uhr schrieb Sanri Parov:

1) How to populate in the simplest way the table?

Use the

- (SQLRow*)rowAtIndex:(int)inIndex;

method of SQLresult and

- (NSString*)stringForColumn:(NSString*)inColumnName;

from SQLRow.

2) Must I transform the return query values to an NSMutableArray?

No.

3) When and how must I redraw the TableView? As far as it's into a
drawer, before or after the drawer is opened?

You don't. The NSTableView draws itself when necessary. If you want the table view to inform of a change in your data source, use - (void)reloadData

In case want to force a redraw anyway use - (void)setNeedsDisplay:(BOOL)flag

Let's say my database is very simple: the records are 'name' and 'age'

You could set the corresponding table column identifiers to "name" and "age" in Interface Builder and do something like this:

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
NSString *result = nil;
SQLRow *row = [yourSQLResult rowAtIndex:rowIndex];
if (row) {
result = [row stringForColumn:[aTableColumn identifier]];
}
return result;
}

Hope this helps.


bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >SQLite and TableView (From: Sanri Parov <email@hidden>)

  • Prev by Date: Re: SQLite and TableView
  • Next by Date: Re: Hide and go seek.
  • Previous by thread: Re: SQLite and TableView
  • Next by thread: NSDocument Default Contents
  • Index(es):
    • Date
    • Thread