
$(document).ready(function() { tabStrip = $("#chPage").kendoTabStrip({ select: onSelect, animation: false });function onSelect(e) {$(document).ready(function() { switch(e.item.id) { case "chBtn1" : $('#chPage-1').empty(); break; case "chBtn2" : $('#chPage-2').empty(); break; case "chBtn3" : $('#chPage-3').empty(); break; } fillPages();}
function read() {
echo(json_encode($this->news_model->read());
}
function update() {
$records = json_decode(stripslashes($this->input->get(‘models’)), true);
$this->news_model->update($records);
}
function destroy() {
$records = json_decode(stripslashes($this->input->get(‘models’)), true);
$this->news_model->destroy($records);
}
function create() {
$records = json_decode(stripslashes($this->input->get(‘models’)), true);
$this->news_model->create($records);
}
MODEL
function read() {
$this->db->select(“*”);
$query = $this->db->get(‘news’);
if($query->num_rows() > 0) {
$newsList = array();
foreach($query->result() as $news) {
$newsList[] = $news;
}
return($newsList);
}
}
function update($records) {
foreach($records as $r) {
$this->db->where(‘id’, $r['id']);
$this->db->update(‘news’, $r);
}
}
function destroy($records) {
foreach($records as $r) {
$this->db->where(‘id’, $r['id']);
$this->db->delete(‘news’);
}
}
function create($records) {
foreach($records as $r) {
$this->db->insert(‘news’, $r);
}
}