Coder Social home page Coder Social logo

bookshelf-pagemaker's People

Contributors

bhoriuchi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bookshelf-pagemaker's Issues

tootal page after where clause

first of all great job !!

        pagemaker(Model.QuoteTag).forge()
            .query(function(qb) {
                qb.where('tag_id_id', 'LIKE', result.get('id'));
            })
            .paginate({
                request: req
            })
            .end()
            .then(function (data) {
                res.json(data);
            });

result of this query is not giving filted total pages I mean
if I have total 10000 data and 100 data belongs to x,
and when I am searching for x it showing total 10000 not 100 (suppose limit is 1)

here is the orignal result

{
"previous": "URLpage=101",
"current": "URLpage=102",
"next": "URLpage=103",
"limit": 40,
"pagesTotal": 2877,
"pagesFiltered": 2877,
"resources": [
// null bcz totalPage is 105 but showing 2877 !!
// 2877 is actual totalPage without where clause
]
}

Express Request with datatables server side not working postgres

please help me :(

controller:

pm(User, 'datatables').forge()
        .limit(req.query.start)
        .paginate({
            request: req,
            withRelated: ['location', 'division'],
        })
        .end()
        .then(function(results) {
                res.send(results);
        });

view:

$("#data-users").DataTable({
        "order": [[ 2, "asc" ]],
        "aoColumnDefs": [{ 'bSortable': false, 'aTargets': [0 , 1, 8] }],
        "processing": true,
        "serverSide": true,
        "ajax": {
            url: "/users/data",
            type: 'GET'
        },
    })

Ordering related columns not working [Express][Postgres]

Hi bhoriuchi, please help me

Controller:

pm(PartCondition, 'datatables').forge()
            .paginate({
                request: req,
                withRelated: ['part'],
            })
            .end()
            .then(function(results) {
                res.send(results);
            });

View:

$("#data-partConditions").DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": {
            url: "/conditions/data",
            type: 'GET'
        },
        "columns": [
                { "data": "part.name",
                   orderable: true },
                { "data": "description",
                   orderable: true },
              ]
    })

image

When I clicked Description column, sorting was worked, but when I clicked Part Column not worked.
Is it possible to sorting related column with bookshelf-pagemaker?

Thanks

witRelated not working

The withRelated not working for me... I have this code.

var Doctor = ORM.Model.extend({
  tableName: 'doctors',
});

var Pacient = ORM.Model.extend({
  tableName:  'pacients',
  hasTimestamps: true,
  doctor: function() {
    return this.belongsTo(Doctor, 'doctor_id');
  } 
});

if I use this:

new Pacient()
  .fetchAll({ withRelated: ['doctor'] })
  .then(function (pacientes) {
    // Result
    [
      {
        id: 1,
        name: 'Paciente name',
        doctor_id: 3,
        doctor: {
          id: 3,
          name: 'Doctor name',
        }
      }
    ]
  });

But if I use pagination my result is this:

pm(Pacient)
  .forge()
  .paginate({ withRelated: ['doctor'] })
  .end()
  .then(function (pacientes) {
    // Result
    [
      {
        id: 1,
        name: 'Paciente name',
        doctor_id: 3
      }
    ]
  });

sorry for my bad english...

der

Change currentPage path/uri

How would I set the path for the currentPage/next/previous? By default it looks like it pulls the tableName if schema._path.path is not set, but I could not find in the code where that could be set.

Get total rows

How can I get the total rows?

var pm = require('bookshelf-pagemaker')(bookshelf);

var User = bookshelf.Model.extend({
  tableName: 'users'
});

pm(User).forge()
  .limit(2)
  .page(2)
  .paginate()
  .end()
  .then(function(results) {
    console.log(results.total);
  });

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.