Update Cell value (html)

Update Cell value (html)

prasadvprasadv Posts: 2Questions: 1Answers: 0
edited October 2016 in Free community support

As in the attached image i need to update the cell (without refreshing table) when clicked on star when data == "false",
I am applying a custom function ApplyFavourite to perform the action

 var custno = full.Customerno;

if (data == "true") {
    return "<span class='glyphicon glyphicon-star'  style='color :#FFFF00 ;text-shadow: -2px 0 #aeae1b, 0 -2px #aeae1b, 2px 0 #aeae1b, 0 2px #aeae1b;font-size:15px;'></span>"; 
}
else {
    return '<a onclick=\'angular.element(this).scope().ApplyFavourite("' + custno + '","' + 1 + '")\' class="clslink"><span class="glyphicon glyphicon-star-empty" title="Click to mark as favourite" style="font-size:13px;"></span></a>'; 
}

How do i get the specific cell value in this case, and then update the cell , so the cell will be seen with a yellow star i.e it is updated as favourite.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 61,985Questions: 1Answers: 10,162 Site admin

    Use cell().data() to update a cell's data. That same method can also be used to get the cell's current data.

    Allan

  • prasadvprasadv Posts: 2Questions: 1Answers: 0
    edited October 2016

    But how will i get the Cell.data() in ApplyFavourite() function.
    Below is how my column rendered.

    {
                    "aTargets": [9],
                    "mRender": function (data, type, full) {
                     var custno = full.Customerno; 
                     if (data == "true") {
                                               return "<span class='glyphicon glyphicon-star'  style='color                             :#FFFF00 ;text-shadow: -2px 0 #aeae1b, 0 -2px #aeae1b, 2px 0 #aeae1b, 0 2px #aeae1b;font-size:15px;'></span>";
                        }
                      else {
                                 return '<a onclick=\'angular.element(this).scope().ApplyFavourite("' + custno + '","' + 1 + '")\' class="clslink"><span class="glyphicon glyphicon-star-empty" title="Click to mark as favourite" style="font-size:13px;"></span></a>';
                              }
                     }
    
    ---------------------------------------------------------------------------------------------------------------
    function ApplyFavourite( custno, flag){
                
         /*how do I get **Cell.data()** here*/
    }
    
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • allanallan Posts: 61,985Questions: 1Answers: 10,162 Site admin

    Do you want the rendered data, or the unrendered data? If the rendered data use cell().render(). For the unrendered data use cell().data().

    Allan

This discussion has been closed.