Duki 552 Nearly a Posting Virtuoso

hey everyone - I'm trying to figure out how to call the appropriate httpPost methods for a particular jtable instance? I thought it was specified by the actions in the javascript, but I can't figure it out. Can anyone give me a hand? Here's my script and the httpPost method - it's located in the CompetitionController.cs file

 <div id="CompetitionTable""></div>

<script type="text/javascript">

    $(document).ready(function () {

        //Prepare jtable plugin
        $('#CompetitionTable').jtable({
            title: 'The Events List',
            paging: true, //Enable paging
            pageSize: 10, //Set page size (default: 10)
            sorting: true, //Enable sorting
            defaultSorting: 'Name ASC', //Set default sorting
            actions: {
                listAction: '@Url.Action("EventList", "CompetitionController")'
            },
            fields: {
                EventID: {
                    key: true,
                    create: false,
                    edit: false,
                    list: false
                },
                EventName: {
                    title: 'Name',
                    width: '15%'
                },
                CompetitorEmail: {
                    title: 'Email address',
                    list: false
                },
                CompetitorName: {
                    title: 'Competitor',
                    width: '15%',
                },
                Score: {
                    title: 'Score',
                    width: '10%',
                }
            }
        });

        //Load list from server
        $('#CompetitionTable').jtable('load');
    });

</script>


 [HttpPost]
        public JsonResult EventList(int compId)
        {
            try
            {
                //Get data from database
                List<Event> events = Event.getEventsByCompetitionId(compId);

                //Return result to jTable
                return Json(new { Result = "OK", Records = events});
            }
            catch (Exception ex)
            {
                return Json(new { Result = "ERROR", Message = ex.Message });
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.