0

I don't know whats happen with my jqgrid,for the 1st time my data can show (all data which already input to database).

But, after I try to input date format from jquery datepicker like: datepicker

I choose 08/03/2011 but actual date is 09/09/2011. the jqgrid can't display that data, but in database the data is already input. could you tell why its happen?


EDIT

this is for the input page:

    <script type="text/javascript" language="javascript" src="js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/jquery.datePicker-2.1.2.js"></script>
    <script type="text/javascript" language="javascript" src="development-bundle/ui/jquery.ui.datepicker.js"></script>

<script>
        $(function() {
                        $(".datepicker").datepicker({ dateFormat:'yy-mm-dd'});
                        });
  </script>

<input type="text" id="datepicker" name="prob_date" class="datepicker">

and I get a downloaded folder jqgrid_demo38 and for the display page(use jqgrid):

    <link rel="stylesheet" type="text/css" media="screen" href="jqGrid/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="jqGrid/plugins/ui.multiselect.css" />
        <script src="jqGrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
        <script src="jqGrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
        <script type="text/javascript" language="javascript" src="js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" language="javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script>

i'm just can't show the data which not inputed in the current month.

Jqgrid

dounfinish.php

nunu
  • 2,703
  • 9
  • 33
  • 55
  • You should include the code which you use. The best is the code which can reproduce the problem. – Oleg Sep 08 '11 at 10:41
  • which code, jquery or jqgrid? – nunu Sep 10 '11 at 06:39
  • It's a **very bad** question. You should include the *version nummer* of jQuery, jQuery UI, jqGrid which you use. The list of JavaScript files is also needed. Then you should include **your JavaScript code** (where you use jqGrid and the datepicker) which can be used to reproduce the described problem. – Oleg Sep 10 '11 at 08:06

2 Answers2

0

Big guess here but I'm guessing you're trying to set a maxDate on your datepicker. If that's so, then the date you're passing to maxDate is probably not correct.

Here's what I suggest to create a consistent date object for your maxDate across the various browsers:

HTML:

<input name="datetime" class="datetime" type="text" data-maxdatetime="<YOUR MAX DATE FROM DB HERE>" value="<SOME PRE-SELECTED DATETIME>" />

JS:

var max_date = $(".datetime").data("maxdatetime");
$(".datetime").datepicker({
  maxDate: parseISO8601(max_date)
});


/**
* http://jibbering.com/faq/#parseDate
* Parses string formatted as YYYY-MM-DD to a Date object.
* If the supplied string does not match the format, an 
* invalid Date (value NaN) is returned.
* @param {string} dateStringInRange format YYYY-MM-DD, with year in
* range of 0000-9999, inclusive.
* @return {Date} Date object representing the string.
*/
function parseISO8601(dateStringInRange) {
  var isoExp = /^\s*(\d{4})-(\d\d)-(\d\d)\s*$/,
      date = new Date(NaN), month,
      parts = isoExp.exec(dateStringInRange);

  if(parts) {
    month = +parts[2];
    date.setFullYear(parts[1], month - 1, parts[3]);
    if(month != date.getMonth() + 1) {
      date.setTime(NaN);
    }
  }
  return date;
}
Patrick Berkeley
  • 2,206
  • 21
  • 26
0

It works....

I am Deleted some command in query:

$start = $limit*$page - $limit; // do not put $limit*($page - 1)
$SQL = "SELECT * FROM oqc_defect ORDER BY $sidx $sord /*LIMIT $start , $limit*/";
$result = mysql_query( $SQL ) or die("Couldnt execute query.".mysql_error());

I am disabled LIMIT from query.

But, I don't know why it can works..may be another reader can explain this.

nunu
  • 2,703
  • 9
  • 33
  • 55