Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Dynamic title

VipVip
edited November 2016 in Tipped

Hi

I am trying to return a dynamic title for each line in a jqgrid. Any help would be much appreciated.

I am using the following code:

Tipped.clearAjaxCache();

    Tipped.remove('.contract_tip'); 

    // **** info functions  
    Tipped.create('.contract_tip', {
        ajax: {
            url: 'tooltip.tip_contractInfo',
            type: 'post',
            data: $(this).closest('tr').attr('id'),
            cache: false,
            success: function(data, textStatus, jqXHR){
                this.update({
                    title: data.title,
                    content: data
                });

                return false;
            }
        },
        skin: 'light',
        radius: true,
        position: 'bottomleft',
        showOn: 'click',
        voila: false
    });

The return string is as follows:
... id="755B83CE-FC5F-8511-50BC19AC3F2D8F09" class="contract_tip" data-tipped-options="ajax: { data: { id: '755B83CE-FC5F-8511-50BC19AC3F2D8F09',title:'test' } }"

What am I doing wrong?

Thank you.

Comments

  • edited November 2016

    That looks like some code from an earlier version of Tipped. Using the latest version the success callback should return an object:

    success: function(data, textStatus, jqXHR) {
      return {
        title: data.title,
        content: data.html
      };
    }
    

    Both title and content should be a string. Have a look at this example:

    http://tippedjs.com/documentation/#usage_json

    It doesn't look like you're using JSON though, if your reponse data is a string you can't have both data and data.title. You'd have to use JSON to store more in an object just like the example in the documentation.

Sign In or Register to comment.