jeudi 5 février 2015

jTable and storing selected rows information during moving through the table


I try to modify client example (loading data from mysql table using php script) source code from: http://ift.tt/1zDCFFY


It looks now like that:



<div id="PeopleTableContainer" style="width: 600px;"></div>
<script type="text/javascript">

$(document).ready(function () {

//Prepare jTable
$('#PeopleTableContainer').jtable({
title: 'Table of people',
paging: true,
pageSize: 10,
sorting: true,
defaultSorting: 'Name ASC',
selecting: true, //Enable selecting
multiselect: true, //Allow multiple selecting
selectingCheckboxes: true, //Show checkboxes on first column
actions: {
listAction: 'PersonActionsPagedSorted.php?action=list',
updateAction: 'PersonActionsPagedSorted.php?action=update'
},
fields: {
PersonId: {
key: true,
create: false,
edit: false,
list: false
},
Name: {
title: 'Author Name',
width: '40%'
},
Age: {
title: 'Age',
width: '20%'
},
RecordDate: {
title: 'Record date',
width: '30%',
type: 'date',
create: false,
edit: false
}
}
});
//Load person list from server
$('#PeopleTableContainer').jtable('load');

});

</script>


My 3 questions (maybe very huge and the need separate threads) are:



  1. how to store information about selected after reload tablegrid for instance during skipping to new page inside table?

  2. how to select row programmatically depending for example on value in one of its field?

  3. how to sort rows to obtain selected rows first - is there this functionality in jtable or only one way is to send information about selected rows to server side for sorting it in sql code?





Aucun commentaire:

Enregistrer un commentaire