Skip to content

Commit

Permalink
update result menu with getRow
Browse files Browse the repository at this point in the history
  • Loading branch information
agungsugiarto committed Aug 22, 2020
1 parent 98b7c7d commit c0ed311
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Models/MenuModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function getMenuDriverMySQLi($id)
->join('auth_groups', 'groups_menu.group_id = auth_groups.id', 'left')
->where('menu.id', $id)
->get()
->getResultArray();
->getRow();
}

/**
Expand All @@ -115,7 +115,7 @@ private function getMenuDRiverPostgre($id)
->where('menu.id', $id)
->groupBy(['menu.id', 'groups_menu.menu_id'])
->get()
->getResultArray();
->getRow();
}

/**
Expand Down
18 changes: 9 additions & 9 deletions src/Views/Menu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,18 @@ function menu() {
});
var editForm = $('#form-edit');

var group_id = response.data[0].group_id;
var group_id = response.data.group_id;
var group = group_id.split('|');
var parent_id = response.data[0].parent_id == 0 ? 0 : response.data[0].parent_id;
var parent_id = response.data.parent_id == 0 ? 0 : response.data.parent_id;

editForm.find('select[name="active"]').val(response.data[0].active).change();
editForm.find('select[name="active"]').val(response.data.active).change();
editForm.find('select[name="parent_id"]').val(parent_id).change();
editForm.find('select[name="groups_menu[]"]').val(group).change();
editForm.find('input[name="icon"]').val(response.data[0].icon);
editForm.find('input[name="icon"]').val(response.data[0].icon);
editForm.find('input[name="title"]').val(response.data[0].title);
editForm.find('input[name="route"]').val(response.data[0].route);
$("#menu_id").val(response.data[0].id);
editForm.find('input[name="icon"]').val(response.data.icon);
editForm.find('input[name="icon"]').val(response.data.icon);
editForm.find('input[name="title"]').val(response.data.title);
editForm.find('input[name="route"]').val(response.data.route);
$("#menu_id").val(response.data.id);
$('#modal-update').modal('show');

}).fail((jqXHR, textStatus, errorThrown) => {
Expand Down Expand Up @@ -324,7 +324,7 @@ function menu() {
})

$('#modal-edit').on('hidden.bs.modal', function() {
$(this).find('#form-edit')[0].reset();
$(this).find('#form-edit').reset();
$('.is-invalid').removeClass('is-invalid');
$('.invalid-feedback').removeClass('invalid-feedback');
});
Expand Down

0 comments on commit c0ed311

Please sign in to comment.