Hi,

I just installed Table Manager a few hours ago, added a few tables, and imported a larger one from a CSV file; everything so far works very well, it is a really great tool, and IMHO the content type "table" should be included in Drupal core.

However, when displaying a larger table, it would be nice to be able to filter it dynamically (e.g. with checkboxes or with a string, that can be inserted into a textfield; this could be displayed on top or at the bottom of the table.

Is there something similar already existing and I just haven't found it, or is some kind of filtering meybe planned for a future release?

Thanks agein for the grat module,
-asb

Comments

pobster’s picture

Hiya!

Sorry I haven't replied sooner, had family staying this weekend for Easter and I've not really had a chance to use my PC until tonight...

Thanks for your positive comments! :o) It's rare that I actually get any! (You have to understand that Table Manager was the first thing I ever wrote in PHP and although that was a few years ago now, the code is still a bit 'amateur' in places - hence the upcoming rewrite to Tablemanager V2!) I really don't think version one of Tablemanager could ever be core... It's use of serialized arrays is *BAD* as it's extremely slow... I only did it that way because I didn't know any better and I'd actually copied the functionality from another module as I had no idea of how to do it myself (at the time I mean, quite the expert now!) Tablemanager V2 creates tables sensibly like CCK does, each table has its very own db table - this opens the door for users to create their own queries and indeed use complicated sql to return rows dynamically (can you see where I'm going with this yet?!) so while yes, version two could be a candidate for core and is a lot easier to program your suggestion for...

...That said, I've just put out a new version of tablemanager dev (for 6.x) which uses checkboxes for multiple deletion. I reckon I could probably use these same checkboxes to submit a 'view' which you could name and then select via a selection box or something. The table would then change to show only those rows. If that's useful let me know and I'll try and do it? Obviously I'd need to get it working in 6.x before I'd consider backporting to 5.x though... (As 6.x is HEAD/ dev for me now).

Thanks,

Pobster

asb’s picture

Hi pobster,

> Table Manager was the first thing I ever wrote in PHP and although that was a few years ago now, the code is still
> a bit 'amateur' in places - hence the upcoming rewrite to Tablemanager V2!)

If Table Manager was your first PHP program, for sure you have some serious software development background in *other* programming languages; at least from my point of view as a user and an administratrator, the module appears much too mature to be the product of an "amateure" (especially considering the reliability and usability of many other Drupal modules).

> Tablemanager V2 creates tables sensibly like CCK does, each table has its very own db table - this opens the door for users
> to create their own queries and indeed use complicated sql to return rows dynamically (can you see where I'm going with this yet?!)

WOW! I'm looking forward to see this!

> I reckon I could probably use these same checkboxes to submit a 'view' which you could name and then select via a selection box or something. The table would then change to show only those rows. If that's useful let me know and I'll try and do it?

Probably that would do the trick. What I had in mind was basically the same we have in http://drupal.org/project/Modules: An pulldown menu that allows to choose between "5.x" and "6.x"; the menu items could be filled in from a selection field, if avaiulable in the table. If not available, there could be a simple text field, working on a selected column of the table; if I enter a string in this field, the table could show only the data mathing "string" (or filter out anything matching "string", depending on how the filter works). With some optional AJAX or Jquery, this could be a lot of fun to play with ;-)

> Obviously I'd need to get it working in 6.x before I'd consider backporting to 5.x though... (As 6.x is HEAD/ dev for me now).

Hm, I won't be able to migrate my sites to D6 for some time (until CCK, Views, and a bunch of 3rd party modules become available); if I can help, I'd need to get some live data into my D6 testing environment; please drop me a line if I should look into this. I'd love to see a migration path from Tablemanager V1 to Tablemanager V2, anyway...

During the last few days I noticed some oddities in Tablemanager V1 which you might want to look into, if your time permits; I tried to build some filters by using the syntax described in http://drupal.org/project/tablemanager:

* In a table with data imported via admin/content/tablemanager/csv, I can't change the Data type of an of the fields; e.g. I've a field with values ranging from 1 to 10 in column 7; I'd like to convert this to an selection list. Maybe in future version this might become possible?

* In the same table, I'm unable to delete Column 5 (Data type: Text; Required: No; Sorting Options: none). If I click on "Delete Column 5", I got the message "Table '4' has been edited", but Column 5 is still there. The user account I'm working under has full access to this table. I'm not sure if I'm doing something wrong here...

* For this table, this syntax works:

[tablemanager:4, 25, TRUE]

As it is supposed to do, it outputs the full table, with 25 records per page/node. However, the following syntax does not work:

[tablemanager:4, NULL, FALSE, column = 7 | start = "1"]

I want to filter out any records in column 7 that match "1"; instead of doing this, I simply get an empty table with the notice "No table data available." This column's data type is "text" (as everything else in the imported table mentioned above).

The following query doesn't deliver any records, also:

[tablemanager:4, NULL, TRUE, column = 6 | start = "Belgien"]

This should output any records matching "Belgien" in column 6; there are matching records, but again the table is empty. Am I doing something wrong here?

Thanks again for this cool module!
Greetings, -asb

pobster’s picture

I'm afraid I've really got absolutely NO programming experience whatsoever bar what I've gained from just 'trying out' stuff on here. I seriously, seriously learnt php from reading the php snippets page in the Drupal handbook and just trial and error. I tried to write something in php once and didn't realise a few of the commands I was using were Drupal specific! Obviously I've improved a lot since I started using Drupal three years ago, hence how comes I'm a bit better at coding stuff now! ;o) I've even done a bit of freelance programming!

I think I only know any programming at all due to owning a ZX Spectrum when I was young, we did have computer science back at school in 1990 on BBC micros. I remember the second day of it (the first day we weren't allowed on the computers) we had to write a one line program. Most people wrote their name repeating over the screen, mine was randomly overlaying multi-coloured triangles all over the screen in random dimensions. I remember the teacher saying "that's very nice, but you were supposed to only use one line" - of course it gave me great pleasure to tell him and show him it was only on one line ;o) Me and my friends caught him a couple of years later passing that very same example off as his own work!!! I seriously didn't touch/ own or even use a PC until 1998 and didn't start programming again until 2005 at age 29, it's never too late to start learning something different. That's a break of 12 years as I left school after my GCSEs and started working at age 17!

Anyways, that's enough background - onto your questions!

Don't worry there's already an automatic converter for TM1 -> TM2 tables, that works just fine it's been ultra tested and is pretty bulletproof I hope!

I started to program the 'views' bit already, but I've hit upon a couple of problems with the table edit function which I'd like to iron out first before I do that (with the js tabledrag function). It's on the cards still, just obviously the table edit function is a bit more important! ...Not that I've looked at it in about a week...

The column delete function broke due to a change to Drupal core, I've never been able (or willing) to fix it as it took a complete rewrite of the entire function to get it working for the 6.x version. The actual function works just fine in 5.x, all that's broken is the link to it - you can call it manually if you really need to. I only didn't worry about fixing it before as I'd started to code version 2 already and I didn't want to go back over version 1 again.

It's intentional to not be able to change data types from csv... That's to do with having to check every cell is correct and it's quite a pain... You can easily override this behaviour though, I'll look it up tomorrow as it's late here (half past midnight!) and I need to be up in three hours for work... Yawn... All that's stopping you from changing it is me disabling the selection box!

The filter functions I believe work on human numbering of the fields... Or maybe it's vice versa... I can't remember what I did now! Anyways, I'd try perhaps changing the column to reflect both instances of using the first column as '0' and as '1' - see how it goes. That functionality does work just fine and in V2 it's even better as you can use sql queries to return stuff, so you can be quite creative with what gets displayed!

Night!

Pobster

pobster’s picture

Status: Active » Closed (duplicate)

http://drupal.org/node/232776

Merging related issues.

Pobster

pobster’s picture

Status: Closed (duplicate) » Closed (fixed)