JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 20th, 2012, 02:23 PM
swetha438 swetha438 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 swetha438 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 2 sec
Reputation Power: 0
jQuery - Filter > Date field submenu order incorrect (random)

Date field option values in the Filter submenu were not sorted correctly - they appear in random order.In the drop down submenu dates are not sorted,actually they sorted in alpha but not not depending on the dates when they have occurred.
Following is the code which I have used:-

function getGridData(sCol) {
var nCol = getColumnIndex(sCol), aUniqueValues = [],
sFieldType = window.aoColumns[nCol].sFieldType.toLowerCase(),
sSeparator = sFieldType == "checkbox" || sFieldType == "multiselect" ? "|" : sFieldType == "csv" ? "," : "",
aTrs, aData, sVal, aVals;

if (window.oDataTable.dataTableSettings[0].bFiltered) {
aTrs = oDataTable.$('tr', { "filter": "applied" });
aData = [];
aTrs.each(function () {
aData.push(oDataTable.fnGetData(this));
});
}
else {
aData = window.aaData;
}

for (var i = 0; i < aData.length; i++) {
sVal = aData[i][nCol];
if (sVal && sVal != " ") {
yellow Code:
Original - yellow Code
    if (sFieldType == "date")                 sVal = $.fullCalendar.formatDate(new Date(ticksToDateTime(sVal)), "ddd, MMM d, yyyy");

if (sSeparator) {
aVals = sVal.split(sSeparator);
for (var j = 0; j < aVals.length; j++) {
if (aUniqueValues.indexOf(aVals[j]) == -1)
aUniqueValues.push(aVals[j]);
}
}
else if (aUniqueValues.indexOf(sVal.toLowerCase()) == -1) {//Per team design decision, ALL Rapid Hire screen media text is lower case
aUniqueValues.push(sVal.toLowerCase());
}
}
}

aUniqueValues.sort(basicSort);

return aUniqueValues;
}

I think I need to change sth which I have highlighted in the yellow.So any one know about this issue?.If yes please reply to this post.

Thanks in advance..

Reply With Quote
  #2  
Old December 22nd, 2012, 09:29 PM
AndrewSW's Avatar
AndrewSW AndrewSW is offline
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 1 m 13 sec
Reputation Power: 164
I'm guessing you might intend to exclude an empty value, rather than specifically a space?
Code:
if (sVal && sVal != "") {

but this is probably not the issue.

Use window.alert(sFieldType) or console.log(sFieldType) to discover what value it contains.

I assume, also, that ticksToDateTime is defined somewhere and works as you expect it to?

You need to highlight your code and click the hash sign (#) to wrap it in code tags - it is very difficult to read otherwise. Previewing your post before submitting it will help with this.

Last edited by AndrewSW : December 22nd, 2012 at 09:32 PM.

Reply With Quote
  #3  
Old January 2nd, 2013, 10:39 AM
swetha438 swetha438 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 swetha438 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 2 sec
Reputation Power: 0
Date field option values in the Filter submenu were not sorted correctly

1.What value we can include instead of space for if condition
if (sVal && sVal != "") {..?

2.I see date as message in the window when I try to include window.alert(sFieldType) and nothing in the error logs when I try to include console.log(sFieldType) after if condition
if (sFieldType == "date").


3.The function ticksToDateTime is shown mentioned below.

function ticksToDateTime(nTicks) {
var N_EPOCH_TICKS = 621355968000000000;
var N_TICKS_PER_MILISECOND = 10000;

return (nTicks - N_EPOCH_TICKS) / N_TICKS_PER_MILISECOND;
}

But I don't understand the code for function ticksToDateTime though because I'm working on already existed project(enhancement). Can anyone please help me with this further.


Thanks,
Swetha.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > jQuery - Filter > Date field submenu order incorrect (random)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap