Okay
  Public Ticket #869396
Spreedsheet with two tables
Closed

Comments

  •  2
    Alexander started the conversation

    Hello!

    I have got a google spreadsheet (autoupdate mode) with some table sheets / tabs.

    Creating and displayin a table OR a chart works as ist should.

    Now i am trying to create a wptablecchart from table tab 1 AND a wpdatatable from table tab 2 it breaks the HTML output / dom loading of the wp site. 

    I think it has something to do with the urls to provide for the charts. Maybe the grid id...

    First table: .../pubhtml?gid=0&single=true

    Second table: .../pubhtml?gid=213166309&single=true

    I guess wpdatatable is not able to do that.

    Right? Any ideas?

    Thank you!

    Alex

    PS: My Code ist an old one and doesn't work in the form above. Maybe you will help nevertheless...

  •   Alexander replied privately
  • [deleted] replied

    Hi,


    Please send me a link so I can take a look as well as link to google spreadsheet tables links.



  •   Alexander replied privately
  • [deleted] replied

    Hi Alexander,

    To be able to help you I need administrator level account. 

  •  2
    Alexander replied

    Uups, sorry. Now you are an admin.

  • [deleted] replied

    Hi Alexander,


    We are using first row in the table to determinate column name and first column to determine row number and in both of your tables second column is much longer than first one which is causing this error. 

    Please adjust your tables so they have the same column length. 

  •  2
    Alexander replied

    Thank you for figuring that out!

    But please! I don't realy understand what you mean. What do i have to do?

    What exactly is column length?

  •   Alexander replied privately
  • [deleted] replied

    Hi Alexander,


    It should be fixed now. It was small issue with gid (sheet identifier). Please test it now and if it's working just copy this file to your production website 

    ../wp-content/plugins/wpdatatables/source/class.wdttools.php

  •  2
    Alexander replied

    Hello Miljko!

    Thank you very much for your great support! Now it works perfectly.

    Greetings from Munich

    Alex

  •   Alexander replied privately
  •   Alexander replied privately
  • [deleted] replied

    HI Alexander,

    Solution for this problem should be included in next version of our plugin but please keep your backup just in case.

    For your second question best way to do this is to move all your customizations to function.php. For column type URL we have this filter 

    wpdatatables_filter_link_cell( $formattedValue )

    which allows you to adjust data in URL columns. Please take a look at this Video tutorial which will show you how to use filters and actions in function.php

    The code could look similar to this example:

    function change_url_function($formattedValue) {
       
        //This will try to find || in your URL and if it doesn't find it it will do your code
       if ( strpos( $formattedValue, '||' ) === FALSE ) {
       //    ...your logic here...
       }
    
       // This will find all string '_blank' and change it to '_self'
       $formattedValue = str_replace('_blank','_self', $formattedValue);
       return $formattedValue;
    }
    
    add_filter('wpdatatables_filter_link_cell', 'change_url_function', 10, 1)



  •  2
    Alexander replied

    Thank you verry much! Problem is solved. You can close this ticket. :-)

    I needed to make a change to your demo code because in $formattedValue there will never be a "||". $formattedValue is createt after your class has built the link. ;-)

    Just for info, if someone needs this also:

    Changing _blank to _self in URL columns and! rewrite the cell value if no URL (with "||") is provided in some cells of this column.

    functions.php

    function change_url_function($formattedValue)
    {
    // If "||" is provided in the cell value, wpdatatables will create the link with an attribute "data-content".
    if(strpos($formattedValue, 'data-content') === FALSE)
    {
    $formattedValue =  strip_tags($formattedValue);
    }
    
    // _blank to _self
    $formattedValue = str_replace('_blank', '_self', $formattedValue);
    
    return $formattedValue;
    }
    
    add_filter('wpdatatables_filter_link_cell', 'change_url_function', 10, 1);
    

    Thank you again!

    Great support! :-)

    Alex