Some ideas for file uploads

Discuss MySQL Ajax Table Editor Paid Version

Re: Some ideas for file uploads

Postby frank » Thu Apr 07, 2011 5:24 pm

Hi,

Putting an alert at the top of the function, shows that IE is executing the function. I then commented out the lines you mentioned in ajax_table_editor.js and in IE I get alerts for each table column:

"addDeleteIcon("table_column"); did not execute correctly"

I have no idea what to do next?
frank
 
Posts: 17
Joined: Wed Mar 02, 2011 10:53 am

Re: Some ideas for file uploads

Postby admin » Thu Apr 07, 2011 5:36 pm

Do you have a column named "table_column"?

For a more detailed error message try changing
Code: Select all
alert(info[i].value+' did not execute correctly');

to
Code: Select all
alert(info[i].value+' did not execute correctly. Error: '+e);
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: Some ideas for file uploads

Postby frank » Thu Apr 07, 2011 5:45 pm

No, sorry, I meant to indicate that I get that error for each of the columns in the table.

With your code I get the error:

"addDeleteIcon("start_date"); did not execute correctly. Error: Type Error: Object Required "

Thanks
frank
 
Posts: 17
Joined: Wed Mar 02, 2011 10:53 am

Re: Some ideas for file uploads

Postby admin » Thu Apr 07, 2011 5:53 pm

Try commenting everything out of the addDeleteIcon function and then add a simple line of code and see if it works in ie, something like
Code: Select all
$(col+'_input_cell').innerHTML = 'testing';
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: Some ideas for file uploads

Postby frank » Thu Apr 07, 2011 6:11 pm

This is what I get in IE (as well as Firefox):
Image
frank
 
Posts: 17
Joined: Wed Mar 02, 2011 10:53 am

Re: Some ideas for file uploads

Postby withersdavis » Tue May 24, 2011 11:59 pm

One thing that may hang some people up.

In your $tableColumns variable for the ID column you need to make sure the primary column (e.g. ID) is editable. If it is not the trash can does not appear.

Should be something like this.

Code: Select all
$tableColumns['id'] = array('display_text' => 'ID', 'perms' => 'ETVQSXO');
withersdavis
 
Posts: 5
Joined: Mon May 16, 2011 7:03 pm

Re: Some ideas for file uploads

Postby yamkopp » Wed Sep 28, 2011 5:04 pm

withersdavis wrote:One thing that may hang some people up.

In your $tableColumns variable for the ID column you need to make sure the primary column (e.g. ID) is editable. If it is not the trash can does not appear.

Should be something like this.

Code: Select all
$tableColumns['id'] = array('display_text' => 'ID', 'perms' => 'ETVQSXO');


Hello,

your suggestion was very precious.
I lost two hours in the attempt to let the delete icon appear.
Perhaps the ID column should be editable so that the script can get it. However I do not want to show the ID and make it editable as the user can change it and duplicate it or collide with an existing record.
In this case the solution is add a hidden attribute to edit
Code: Select all
$tableColumns['id'] = array('display_text' => 'ID', 'perms' => 'E', 'hidden_edit' => true);

Luigi
yamkopp
 
Posts: 31
Joined: Sun Jan 24, 2010 11:20 am

Re: Some ideas for file uploads

Postby ArgyrosfeniX » Thu Dec 08, 2011 12:16 am

ericimprint wrote:Awesome. Thanks.

Here is the final code for the next person:

Code: Select all
 
            function deleteFile($info)
                {
                 $query1 = "select $info->col from asi_product_overrides where UniqueId = '$info->id'";
                 $result1 = $this->Editor->doQuery($query1);
                $query = "update asi_product_overrides set $info->col = '' where UniqueId = '$info->id'";
                $result = mysql_query($query);
                if($result)
                   {
                  unlink($this->dataDir.$row[$info->col]);
                   $this->Editor->retArr[] = array('where' => 'javascript', 'value' => '$("'.$info->col.'_file_name_table").remove();');
                   }
                }
         //End Add delete
           

I've taken and adapted the code that ericimprint posted for the rest of us (thanks to everyone that worked all of that code out!), but am having an error thrown with the unlink and the file not being deleted. Not sure what the error is trying to tell me to do...

Help?
SP32-20111207-173954.jpg
SP32-20111207-173954.jpg (36.84 KiB) Viewed 15454 times


Thank you! :oops:
ArgyrosfeniX
 
Posts: 25
Joined: Thu Oct 28, 2010 10:31 pm

Re: Some ideas for file uploads

Postby admin » Thu Dec 08, 2011 2:20 pm

It looks like the $row variable never gets set. You need to retrieve a row from the query result like this
Code: Select all
$row = mysql_fetch_assoc($result1);
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: Some ideas for file uploads

Postby ArgyrosfeniX » Thu Dec 08, 2011 8:21 pm

admin wrote:It looks like the $row variable never gets set. You need to retrieve a row from the query result like this
Code: Select all
$row = mysql_fetch_assoc($result1);


Excellent! Thank you!! :mrgreen:

Here's what I've got afterward:
Code: Select all
  function deleteFile($info)
  {
    $query1 = "select $info->col from items where id = '$info->id'";
    $result1 = $this->Editor->doQuery($query1);
    $query = "update items set $info->col = '' where id = '$info->id'";
    $result = mysql_query($query);
    $row = mysql_fetch_assoc($result1);
    if($result)
       {
        unlink($this->dataDir.$row[$info->col]);
        $this->Editor->retArr[] = array('where' => 'javascript', 'value' => '$("'.$info->col.'_file_name_table").remove();');
       }
  }
//End Add delete
ArgyrosfeniX
 
Posts: 25
Joined: Thu Oct 28, 2010 10:31 pm

Previous

Return to Paid Version

Who is online

Users browsing this forum: No registered users and 3 guests

cron