We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AngularJS $scope variable in rowTemplate

Hi,

I use a rowTemplate (see below) and I want to use a $scope.active variable in the link which is not in the datasource. How can I do that?
Thank you for any help you provide.

<script id="templateData" type="text/x-jsrender">
    <tr role="row" class="">
        <td role="gridcell" class="e-rowcell"><a rel='nofollow' href="teams/teamMembersList?szakosztaly={{:szakosztalyId}}&korosztaly={{:korosztalyId}}&csapat={{:csapatId}}&aktiv={{$scope.active}}">{{:csapatNev}}</a></td>
        <td role="gridcell" class="e-rowcell"><a rel='nofollow' href="userManagement/newUser/{{:edzoId}}">{{:edzoNeve}}</a></td>
        <td role="gridcell" class="e-rowcell">{{:versenyzo}}</td>
        <td role="gridcell" class="e-rowcell">{{:versenyzoFiu}}</td>
        <td role="gridcell" class="e-rowcell">{{:versenyzoLany}}</td>
        <td role="gridcell" class="e-rowcell">{{:megjegyzes}}</td>
    </tr>
</script>

3 Replies

JK Jayaprakash Kamaraj Syncfusion Team November 3, 2015 09:46 AM UTC

Hi Kéki,

We considered the requirement “Angular template support in ejGrid rowTemplate” as a feature request and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.


https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents 


We have tried to achieve the requirement using angular templatecomplie method as a workaround which can be used to link scope and the template together.
Please find the code example and sample, 

<a class='bind' rel='nofollow' href="teams/teamMembersList?szakosztaly={{:EmployeeID}}&korosztaly={{:FirstName}}&csapat={{:LastName}}&aktiv= scopeVal">{{:City}}</a>
……
………….

…………….

$scope.compile = function (el) {
                                                               
                                                                el.each(function(index,obj){
                                                                                var s=$(obj).attr('rel='nofollow' href')
                                                                                $(obj).attr('rel='nofollow' href',s.replace('scopeVal','{{value}}'))
                                                                });
                                                               
                  $compile(el)($scope);
              }
               $scope.complete = function(args){ //grid actionComplete event
                 
                      templateCompile(args);
              }; 
        });
                                function templateCompile(args){
  var scope = angular.element($("#Grid")).scope();
              scope.compile($("#Grid").find('.bind'))//call the angular compile function
          }
 
Sample Link : http://www.syncfusion.com/downloads/support/forum/120999/ze/angular_with_scope_variable-1389030164
Regards,
Jayaprakash K.


KR Kéki Richárd November 3, 2015 01:32 PM UTC

Hi,

Thank you for quick answer.
Your solution is working perfectly.

Thanks again,
Richárd Kéki


JK Jayaprakash Kamaraj Syncfusion Team November 4, 2015 07:01 AM UTC

Hi Keki, 

We are happy that the provided suggestion helped you. 

Please get back to us if you need any further assistance.  

Regards, 

Jayaprakash K.



Loader.
Up arrow icon