开发者

Symfony JEditable retrieve cached results using url_for()

开发者 https://www.devze.com 2023-04-01 01:16 出处:网络
I am having the sort of same cache problem, and couldn\'t get it fixed with above solution. I am using Symfony 1.4, JQuery and JEditable.

I am having the sort of same cache problem, and couldn't get it fixed with above solution. I am using Symfony 1.4, JQuery and JEditable.

Please check out this code:

$('#example tbody td').click( f开发者_JS百科unction () {

    /* Get the position of the current data from the node */
    var aPos = oTable.fnGetPosition( this );

    /* Get the data array for this row */
    var aData = oTable.fnGetData( aPos[0] );
    var d = new Date();
    var data_id = aData[0]*d.getMilliseconds();

    //oCache.lastJson.aData[aPos[0][aPos[1]] = sValue;
    //oTable.fnUpdate( sValue, aPos[0], aPos[1] );

    //alert("aData:"+data_id);
    $('td.cSelect').editable(
        '<?php echo url_for('mymodule/get_data?rid=') ?>'+data_id, 
        { 
              data      : '<?php print  json_encode($array); ?>',
              id        : data_id,          
              type      : 'select',
              submit    : 'OK'
        }
    );
    /* Update the data array and return the value */
    aData[ aPos[1] ] = 'clicked';
    this.innerHTML = 'Select';
} );

Please HELP me!!!


To change the URL where the data is posted to, you need to destroy the editable element first. So, if you do that right before you call .editable(), it should work as expected.

$('td.cSelect').editable('destroy');
$('td.cSelect').editable(
    '<?php echo url_for('mymodule/get_data?rid=') ?>'+data_id, 
    { 
          data      : '<?php print  json_encode($array); ?>',
          id        : data_id,          
          type      : 'select',
          submit    : 'OK'
    }
);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号