ProblemDatentabelle Daten in andere Daten
Ich möchte Bedingungen innerhalb der Datentabellen definieren ..
Also im Grunde verwende ich eine Sitzung, um die Ausgabe der Daten zu filtern.
Fall
ich angemeldet als John:
| Name | Quantity | Action |
| John | 400 | #**CanSeeEditButton** |
| Mia | 300 | #CannotSeeEditButton |
| John | 200 | #**CanSeeEditButton** |
| Alex | 900 | #CannotSeeEditButton |
I Bedingung unten geben will, muss ich session = userId
, und diese Platte Tisch es auch hat, so Ich möchte session userId = record userId
übereinstimmen. und id
unten ist Primärschlüssel der Tabelle (nicht Benutzer-ID)
Ich bin fest, wie man es konditioniert. Hier ist mein Code
<script>
$(document).ready(function() {
$('#dataTable').DataTable({
serverSide : true,
ajax : {
url : '{{ this.url.getBaseUri() }}productionstocklog/read',
method : 'POST'
},
columns: [
{data: "name"},
{data: "qty"},
// I want to give condition below, I have session = userId, and this record table have it too, so I want to match session userId = record userId. and id below is primary Key of table (not userID)
{% if this.session.get('auth')['userId'] == data: "userId" // <-- how to get data:userId in Datatables ? %}
{data: "id", render : function(data, type, full, meta){
return ' <a data-toggle="modal" data-target="#edit" class="btn btn-xs btn-success icon-pencil icon" ' +
' onclick="EditShow(\''+data+'\');"> Edit </a>' +
' <a href="{{ this.url.getBaseUri() }}productionstocklog/delete/'+data+'" class="btn btn-xs btn-danger icon-ban icon" ' +
' onclick="return confirm(\'Delete?\');"> Delete </a> '
}}
{% endif %}
]
});
});
</script>
@Timothy, hallo .. u wieder! danke Bruder ! –