Coder Social home page Coder Social logo

angular-tablesort's People

Contributors

aborchew avatar aleksihakli avatar anber avatar azatoth avatar brandonbird avatar dkurth avatar finitelooper avatar jonespen avatar koen-serry avatar lackovic avatar mattiash avatar nvivo avatar orszaczky avatar tamlyn avatar tbroadley avatar thorbijoern avatar timc13 avatar timigoe avatar witzig avatar yoihito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-tablesort's Issues

Reverse Sorting Issues in Chrome

Hey Mattiash,

I came a crossed another small bug and was wondering if I can get your opinion on it. I am using this directive for a fairly complex table and I needed to create additional filter buttons, so I added an angular OrderBy property to the ng-repeat, on top of the ts-repeat code that's already there for the directive.

Example code:
"< tr ng-repeat="parameter in parameters.response | orderBy:'Value':true | filter:paramquery" ts-repeat >"

This works perfectly in every browser except for Chrome. And chrome will render the results correctly if reverse=false, but once I try to sort with reverse=true, the sort order gets all mixed up. So for a test I removed the ts-repeat line from the code above and the sorting issue was fixed (though it broke the directive, I at least figured out what my issue was). That my new orderBy property is conflicting with the angular-tablesort directive in some way.

Do you have any suggestions on how to fix this? Is there a built-in orderBy variable in the directive that I should target instead of creating a new one?

Thanks again for all your help,
Steve

ts-repeat-start ts-repeat-end problem

Hi

Foer some reason I cannot use the ts-repeat-start ts-repeat-end tags.

I get the following error:
Error: [$compile:uterdir] http://errors.angularjs.org/1.4.2/$compile/uterdir?p0=ts-repeat-start&p1=ts-repeat-end

And the relevant code is:

<table class="table table-condensed table-bordered table-striped" ts-wrapper>
    <thead>
        <tr>
            <th></th>
            <th ts-criteria="id">Transaction #</th>
            <th ts-criteria="completionDate|date">Date</th>
            <th ts-criteria="userId">User</th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat-start="row in ctrl.exchangeTransactions | filter:ctrl.searchString" ts-repeat-start>
            <td>
              <button ng-if="row.expanded" ng-click="row.expanded = false">-</button>
              <button ng-if="!row.expanded" ng-click="row.expanded = true">+</button>
            </td>
            <td>{{row.id}}</td>
            <td ng-bind="row.completionDate | date"></td>
            <td>{{row.userId}}</td>
        </tr>
        <tr ng-if="row.expanded" ng-repeat-end=""  ts-repeat-end>
            <td colspan="4">We shall see this</td>
        </tr>
    </tbody>
</table>

Could you help me out here ?

Thanks

Example for default sort order

Hi,
i just came across your lib. Works really nice, thanks!

Could you supply an example on how to default desc sort a column?

Cheers,
Daniel

get the sorted data back from angular-tablesort

Hi, is there an easy way to get access to the sorted data by tablesort module? From my understanding, the module will make a copy of the original collection and manipulate that copy. If the module can also provide a way to getSortedData(), that will be awesome

Sort on UK Date format

Heya,

Thanks for the lib, works well!!

I was wondering how you go about setting the ts-criteria to get UK date format sorting correctly?

dd/mm/yyyy is the format (25/12/2013) for example.

Cheers,

Programatically change sort option

Is there a function I can call that is the equivalent of clicking one of the columns names?

For instance, clicking a button outside of the table could call the function to change which column the sorting is based on.

My use case is that I have a UI outside the table that changes what data the table contains and it makes more sense for some data to be sorted by one column and others by a different one. I'd like to programatically change which column the table is sorted by when the user clicks to change the table data.

Not working with dirPagination(Michael Bromley)

Hi, ts-repeat directive thorws error when used with dirPagination's dir-paginate directive. Throws this error. cannot read property 'match' of undefined(line no 167). Seems like empty objet is sent to regex match.

Thanks for the effort btw,

logesh

Unable to read filtered count

I'm using a simple text input as filter for my rows in the table.
The rows are filtered correctly with tablesort, but the temporary variable I use for counting filtered/total is empty now.

Example:

<input type="search" ng-model="search" placeholder="Filter"/>
<span>Count: ({{filtered.length}}/{{projects.length}})</span>
<tr ng-repeat="project in filtered = (projects | filter: search)" ts-repeat>...

filtered.length should give me the amount of rows left (It does without tablesort).

Numeric values are not compared as numbers

Intl.Collator should use numeric option when it is comparing numeric values. Now Intl.Collator casts numeric values to strings before comparison. I'm not sure if "numeric: true" works as expected with strings so maybe there should be two different collators

ts-repeat and data is gone

As soon as I add the ts-repeat attribute my data disappears. I'm using firebase and the data is loaded via AJAX.

Anyone seen this behaviour?

    <table class="table table-striped table-hover " id="player-list"  ts-wrapper=>
      <thead>
      <tr width="90%">
        <th><span class="glyphicon glyphicon-edit"></span></th>
        <th ts-criteria="playerJersey" ts-default>Jersey</th>
        <th ts-criteria="playerName">Name</th>
        <th ts-criteria="notes" >Notes</th>
      </tr>
      </thead>
      <tbody>
        <tr width="80%" ng-repeat="player in currentPlayers track by player.playerID "  ts-repeat>
          <td><span ng-click="editPlayer(player)" class="glyphicon glyphicon-edit"></span></td>
          <td>{{player.playerJersey}}</td>
          <td>{{player.playerName}}</td>
          <td>{{player.notes}}</td>
        </tr>
      </tbody>
    </table>

Add compare fallback

Currently Intl is not enough widely supported (my opinion), because for example Safari 9 is lacking the support caniuse.com. Safari 10 has support and it has been released 2 months ago, so 9 is still widely used.

Also IE 10 does not have support for Intl.

I did look for the polyfill, but there is no support for Intl.Collator that is required by this library.

Providing an Intl.Collator implementation is no longer a goal of this project. There are several reasons, including:

  • The CLDR convertor does not automatically convert collation data to JSON
  • The Unicode Collation Algorithm is more complicated that originally anticipated, and would increase the code size of Intl.js too much.
  • The Default Unicode Collation Element Table is huge, even after compression, and converting to a native JavaScript object would probably make it slightly larger. Server-side JavaScript environments will (hopefully) soon support Intl.Collator, and we can't really expect client environments to download this data.

XML Compile

Hey. Compiling the ts-wrapper, ts-default, and ts-repeat doesn't work because the attributes need to have a value (ts-wrapper="something"). Is there a work around to this? Thank you in advance.

Disable pagination

I have a show more button, that appends my table data, after I added this module to my table, it does some type of paging and only displays recent results and hides old one. How can I disable the pagination? And allow it to append the results

angular-tablesort.d.ts is not a module

Getting this error when trying to build my project:

Error TS2656: Exported external package typings file 'SOMEPATH/node_modules/angular-tablesort/typedefs/angular-tablesort.d.ts' is not a module. Please contact the package author to update the package definition.

Default lowercase sorting

We would like to have the possibility to apply some kind of defaults to this directive.
We have solved this manually for now by adding a function inside the script to add default lowercase sorting:

this.addDefaultLowerCase = function (sortexpr) { var expr = sortexpr ? sortexpr.toLowerCase() : sortexpr; if (expr && expr.indexOf("lowercase") < 0) { if (expr.indexOf("parseint") < 0 && expr.indexOf("parsefloat") < 0) { sortexpr += "|lowercase"; } } return sortexpr; }

And then call sortexpr = this.addDefaultLowerCase(sortexpr); inside both setSortField and addSortField.

Do you have any other input on adding such a feature ?

Invalid meta - missing "ignore"

when installing using bower the following warning appears:

bower angular-tablesort#~1.1.0     invalid-meta angular-tablesort is missing "ignore" entry in bower.json
bower angular-tablesort#*          invalid-meta angular-tablesort is missing "ignore" entry in bower.json

tablesort does not allow ng-repeat alias_expression to be used

ng-repeat supports an alias_expression that can be used (for example) to find the length of a filtered object outside of ng-repeat. However when using tablesort, the alias_expression object is empty.

Example alias_expression usage:

<tr ng-repeat="item in items | filter:search as filteredItems">
    <td>{{ item.id }}</td>
</tr>

<p>Number of items shown: {{ filteredItems.length || 0 }}

Example: http://plnkr.co/edit/zObDQ7YY1VEGBwdStWCT?p=preview

ts-repeat is a custom directive

My ng-repeat element is an attribute directive. Can it be that the table-sorting can't work? I get the following error:

Error: [$compile:ctreq] Controller 'browseContent', required by directive 'browseContentItem', can't be found!
http://errors.angularjs.org/1.4.3/$compile/ctreq?p0=browseContent&p1=browseContentItem
    at REGEX_STRING_REGEXP (http://localhost:3000/assets/javascripts/main.js:6298:779)
    at getControllers (http://localhost:3000/assets/javascripts/main.js:10120:255)
    at nodeLinkFn (http://localhost:3000/assets/javascripts/main.js:10137:162)
    at compositeLinkFn (http://localhost:3000/assets/javascripts/main.js:10035:964)
    at publicLinkFn (http://localhost:3000/assets/javascripts/main.js:10014:376)
    at link (http://localhost:3000/assets/javascripts/main.js:21093:45)
    at invokeLinkFn (http://localhost:3000/assets/javascripts/main.js:10223:317)
    at nodeLinkFn (http://localhost:3000/assets/javascripts/main.js:10137:70)
    at compositeLinkFn (http://localhost:3000/assets/javascripts/main.js:10035:964)
    at compositeLinkFn (http://localhost:3000/assets/javascripts/main.js:10035:1073) <tr browse-content-item="" ng-repeat="item in items" item="item" ng-class="{'odd': ng-class-odd, 'even': ng-class-even}" ts-repeat="">

Two columns with same sorting criteria displays incorrectly

Consider the following code:

<table ts-wrapper>
    <tr>
        <th ts-criteria="startdate">Start date
        <th ts-criteria="startdate">Start time
        <th ts-criteria="other">Other column
        <th ts-criteria="something">Something else
    <tr ng-repeat="row in rows" ts-repeat>
        <td>{{ row.startdate | date }}
        <td>{{ row.startdate | date:'shortTime' }}
        <th>{{ row.other }}
        <th>{{ row.something }}
</table>

We use this to display a bunch of rows with varying start dates. We first had it without the ts-criteria on the "Start time" column.
However, when only one day is shown, some users found it confusing they had to click "Start date" to sort by start time, since the date was the same everywhere. So we wanted to add a sortable "Start time" column, which sorts by the same data as "Start date"

This works fine, as long as you don't sort by "start date" first, then by " start time", or the other way around. What you get then is this:

multisort

Is this something that can be fixed, or is there some way to work around this?
Thanks!

Issue with white space | ts-criteria

This is my element {{organic['Average vol.']}}

I've tried:
ts-criteria="['Average vol.']|parseInt"
ts-criteria="'Average vol.'|parseInt"
ts-criteria="Average|parseInt"

but it doesn't work

Tag 1.2 release

Please, tag v1.2 release to use this version with bower.

Thanks and good job!

Sorting by a computed value

Love the tablesorter! This is really good work and I really appreciate it!

Maybe this is my inexperience with angular but is there a good way to sort by a computed value? For example I have a column that uses one of two dates depending on which is more recent.

<table class="table table-striped" ts-wrapper>
        <thead>
            <tr>
                <th ts-criteria="lastContact" ts-default>Last Contacted</th>
                <th>Followup</th>
                <th ts-criteria="Notes">Notes</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="customer in customers" ts-repeat>
                <td>{{lastContacted(customer)  | date}}</td>
                <td><input class="form-control hiddenInput" type="date" ng-model="customer.Followup" ng-change="changeFollowup(customer, $index)" /></td>
                <td><span class="fa" ng-class="customer.Notes ? 'fa-comments': 'fa-comment-o'" ng-click="openNotes(customer)"></span></td>
            </tr>
        </tbody>
    </table>

So...is there a great way to sort by the value that comes of my lastContact(customer)? Thanks again!

ITEMS_PER_PAGE doesn't update CURRENT_PAGE_NUMBER

Hi, I'm not sure if this is a bug or expected feature but here is what I found in the demo examples:
Presume you are showing 10 items per page
Step 1: go to the last pagination page (e.g. page 6)
Step 2: change to show 100 items per page
Step 3: you see nothing

Expected: you should see (at least) 100 items or all. I suspect the model="ITEMS_PER_PAGE" doesn't reset model="CURRENT_PAGE_NUMBER" to 1 if (total_items <= ITEMS_PER_PAGE)

Define Default Sort Programmatically

Would be a nice feature to be able to specify a default sort column when the columns are being rendered via an ng-repeat:

Given the following controller

$scope.columns = ['foo', 'bar', 'biz'];
$scope.collection = [
  {
    'foo': 0,
    'bar': 7,
    'biz': 4
  },
  {
    'foo': 2,
    'bar': 9,
    'biz': 3
  },
  {
    'foo': 1,
    'bar': 1,
    'biz': 99
  }
  //, ...
]

Be able to specify 'bar' as the default sort key, as such

<table ts-wrapper ts-default-key="'bar'">
  <thead>
    <tr>
      <th ng-repeat="column in columns" ts-criteria="{{ column }}">{{ column }}</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="row in collection" ts-repeat>
      <td ng-repeat="column in columns">{{ row[column] }}</td>
    </tr>
  </tbody>
</table>

Duplicate tr with empty td added to table

Adding ts-repeat to the with ng-repeat resulted in a duplicate being generated. The duplicate generated an empty td with a colspan inside of it as well.

It's odd enough that I wanted to bring it up.

collator undefined?

Hi,

I looked in to the new createDefaultComparer() and noticed that

var collator = new Intl.Collator(undefined, { sensitivity: 'case' });

is created inside a scope of createDefaultComparer() function. This means that collator.compare used in line 332 should be undefined, am I right?

compResult = collator.compare(aval, bval);

update versioning tag

Hi Matt, can you update the versioning tag? The current version (i.e. 1.3.1) is out-of-date with recent merges. I think everybody is looking forward to the next tag version

Problems with angular-tablesort

So i found you guys product and i think i found a great product.
The problem is: i can't use it.
Am I missing something?
I'm getting tabular data from a service which returns me a JSON.
I pass it to scope normally using my controller but angular-tablesort don't seems to work with it.
Here's my html
::
`















X PercentChange Last Spread
{{key}} {{value.percentChange}} {{value.last}} {{value.somecalchere- value.somecalcthere}}
` :: and here's my module load: `var app = angular.module('app', ['ui.bootstrap', 'tableSort']);` :: :: :: I'm using AngularJS v1.5.8 angular-tablesort last version . Tablesort seems work with dummy data.

Appling limitTo in ng-repeat causes undefined sort order

So i would like to limit number of displayed rows, but limitTo doesn't work. It is applied before angular-tablesort sorts the table.

example of ng-repeat
person in people_data | search:query | limitTo:limitSize

i think it might be problem with regexp

Poor performance with large resultset

I was wondering if anyone else was experiencing poor performance with large result sets with this module. If I have a table with over 5 or 6 columns and hundreds of rows, it slows to a crawl, and sometimes crashing the browser when re-sorting. I've tried using module "bindonce" in conjunction with this one, but it seems to have no effect. Is there anything I may have missed?

Great module btw tho!

Cheers,
Ben

Natural sort (alphanumeric)

It would be nice to have the option to have alphanumeric sorting so items like:

MUSIC 1
MUSIC 2
...
MUSIC 10

Don't show up as

MUSIC 1
MUSIC 10
MUSIC 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.