Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should create the grid with <code>$("#list").jqGrid({...})</code> and add the navigator buttons with <code>navGrid</code> <strong>only once</strong>. I suppose that your <code>BindGrid</code> function will be called <strong>twice</strong> in your program, so you have all buttons two times. You can easy verify this adding an additional <code>alert("in BindGrid");</code> somewhere inside of <code>BindGrid</code> function.</p> <p><strong>UPDATED</strong>: I read your code and here is my suggestion:</p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ $(document).ready(function () { $("#StartDate").datepicker({ changeMonth: false, changeYear: false }); $("#EndDate").datepicker(); var checkMileageLimit = function(value, colname) { alert($("#TotalMileage").val()); if (value &gt; $("#TotalMileage").val()) { alert(false); return ["false", "value shuld be less"]; } else { alert(true); return ["true",""]; } }; $("#list").jqGrid({ url: '&lt;%= Url.Action("GetScheduleInfo", "TouchSchedule") %&gt;', datatype: 'json', mtype: 'GET', postData: { StartDate: function() { return $('#StartDate').val(); }, EndDate: function() { return $('#EndDate').val(); }, siteId: function() { return $('#ListFacility') ? $('#ListFacility').val() : -1; } }, colNames: ['SiteID', 'Cal Date', 'Store Open', 'Start Time', 'End Time', 'MileageLimit AM', 'MileageLimit PM', 'TouchLimit PM', 'TouchLimit AM', 'Total Touches', 'Total Mileage', 'WeekDay'], colModel: [ { name: 'SiteID', index: 'SiteID', width: 40, /* key: true,*/editable: false, editrules: { edithidden: false }, hidedlg: true, hidden: false }, { name: 'CalDate', index: 'CalDate', width: 100, formatter: 'date', datefmt: 'm/d/Y', editable: true, edittype: 'text', editrules: { required: true, date: true }, formoptions: { elmsuffix: ' *'} }, { name: 'StoreOpen', index: 'StoreOpen', width: 40, editable: true, edittype: 'select', formatter: 'select', editrules: { required: true }, formoptions: { elmsuffix: ' *' }, editoptions: { value: { o: 'Open', c: 'closed'}} }, { name: 'StartTime', index: 'StartTime', width: 100, editable: true, formatter: 'date', masks: 'ShortTime', edittype: 'text', editrules: { time: true, required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'EndTime', index: 'EndTime', width: 100, editable: true, edittype: 'text', editrules: { time: true, required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'MileageLimitAM', index: 'MileageLimitAM', width: 50, editable: true, edittype: 'text', editrules: { custom: true, custom_func: checkMileageLimit, required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'MileageLimitPM', index: 'MileageLimitPM', width: 50, editable: true, edittype: 'text', editrules: { required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'TouchLimitAM', index: 'TouchLimitAM', width: 50, editable: true, edittype: 'text', editrules: { required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'TouchLimitPM', index: 'TouchLimitPM', width: 50, editable: true, edittype: 'text', editrules: { required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'TotalTouches', index: 'TotalTouches', width: 50, editable: true, edittype: 'text', editrules: { required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'TotalMileage', index: 'TotalMileage', width: 50, editable: true, edittype: 'text', editrules: { required: true }, formoptions: { elmsuffix: ' *'} }, { name: 'WeekDay', index: 'WeekDay', width: 200, editable: false, hidden: false} ], pager: $('#listPager'), rowNum: 10, rowList: [10, 20, 30], sortname: 'CalDate', sortorder: "desc", viewrecords: true, caption: 'Schedule Calendar', autowidth: false, afterInsertRow: function (rowid, rowdata) { if (rowdata.IsWeekend) { $(this).jqGrid('setRowData', rowid, false, { color: 'blue' }); } } }).navGrid('#listPager', { edit: true, add: false, del: false, search: false, refresh: true } ); $('#btnSubmit').click(function () { $("#list").trigger("reloadGrid"); }); }); //]]&gt; &lt;/script&gt; </code></pre> <p>I recommend you to use <code>postData</code> with properties <strong>as functions</strong>, then at every refresh will be called the function and you can get actual values from the corresponding HTML controls. You can read more about the technique in <a href="https://stackoverflow.com/questions/2928371/how-to-filter-the-jqgrid-data-not-using-the-built-in-search-filter-box/2928819#2928819">my old answer</a>. Other small changes you will probably find yourself.</p> <p>Moreover the statement</p> <pre><code>$('#ListFacility') ? $('#ListFacility').val() : -1; </code></pre> <p>seems incorrect for me because <code>$('#ListFacility')</code> will be always an object. Because you don't post and HTML code I could not fix it. You should do this yourself.</p> <p>Moreover it can be that you will have better performance in your grid if you will use <code>gridview:true</code> and set the color inside of <code>loadComplete</code> function instead of the usage of <code>afterInsertRow</code> function. See <a href="https://stackoverflow.com/questions/4028019/set-class-or-identifier-on-jqgrid-row-based-on-a-key-value-pair-placed-in-row-li/4028235#4028235">this old answer</a> as an example and description of the <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options" rel="nofollow noreferrer">gridview</a> option.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload