dongpan2788 2015-02-08 01:30
浏览 310

使用angularJS的可编辑表格单元格

Is there a way to show data inside td and allow user to edit it in a way that the change will take place in the sql (MySQL in my case) table? im creating a table from database using angularJS:

Creating The json file from the table:

$result = mysql_query("select * from `user script settings`");
//Create an array
$json_response = array();

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $row_array['user_id'] = $row['user id'];
    $row_array['script_id'] = $row['script id'];
    $row_array['cron_format'] = $row['cron format'];
    $row_array['schedule_last_update'] = $row['schedule last update'];
    $row_array['next_execution_time'] = $row['next execution time'];
    $row_array['script_exec'] = $row['script_exec'];

    //push the values in the array
    array_push($json_response,$row_array);
}
echo json_encode($json_response); 

showing it in the table:

<table class="table table-bordered table-hover">
    <thead>
        <td>user name</td>
        <td>script name</td>
        <td>cron format</td>
        <td>schedule last update</td>
        <td>next execution time</td>
        <td>script exec</td>
    </thead>
    <tbody>
        <tr ng-repeat="x in data">
            <td>{{x.user_id}}</td>
            <td>{{x.script_id}}</td>
            <td>{{x.cron_format}}</td>
            <td>{{x.schedule_last_update}}</td>
            <td>{{x.next_execution_time}}</td>
            <td>{{x.script_exec}}</td>
        </tr>
    </tbody>
</table>
<script>
    function customersController($scope,$http) {
        $http.get("getData.php")//test3.php return a json file of users table
                .success(function(response) {$scope.data = response;});
    }
</script>

I want to allow user to change the cron format value and to update the table ...is there "angularish" way to due that?? if not i'll appreciate guidance for a php solution, thx!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP