Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8905527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:25:04+00:00 2026-06-15T02:25:04+00:00

I am testing out slickgrid. HTML CODE <!DOCTYPE html> <html> <head> <meta charset=utf-8> <title>Slick

  • 0

I am testing out slickgrid.

HTML CODE

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <title>Slick Test</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <link rel="stylesheet" href="jquery-ui.css" type="text/css" />
        <link rel="stylesheet" href="slick/css/slick.grid.css" type="text/css" />

        <script src="jquery.js"></script>
        <script src="jquery.event.drag-2.0.min.js"></script>
        <script src="slick/js/slick.core.js"></script>
        <script src="slick/js/slick.grid.js"></script>
        <script src="slick/js/slick.dataview.js"></script>

        <script src="main/js/main.js"></script>

    </head>

    <body>
        <div style="float:left">
            <input placeholder="EAN Code" type="text" id="ean">
            <input placeholder="Quantity"  type="text"id="qty">
            <input placeholder="Amount" type="text" id="amt">
            <input placeholder="Discount" type="text" id="disc">
            <button id="add-product">
                Add Product
            </button>
        </div>

        <br />

        <div id="invoice-grid" style="clear:both">
        </div>

    </body>
</html>

JS CODE – main.js

var grid, dataView;

var gridOptions, gridColumns;

var products = []

$(function() {


    gridColumns = [
        {id:'ean', name:'EAN', field:'ean', cssClass: 'grid-cell'},
        {id:'qty', name:'Qty', field:'qty', cssClass: 'grid-cell'},
        {id:'mrp', name:'MRP', field:'mrp', cssClass: 'grid-cell'},
        {id:'disc', name:'Discount', field:'disc', cssClass: 'grid-cell'},
        {id:'net_amt', name:'Net Amt', field:'net_amt', cssClass: 'grid-cell'}
    ];

    gridOptions = {
        editable: true,
        autoEdit: true,
        enableAddRow: false,
        enableCellNavigation: true,
        asyncEditorLoading: false,
        enableColumnReorder: false,
        rowHeight: 35
    };

    dataView = new Slick.Data.DataView();

    grid = new Slick.Grid($('#invoice-grid'), dataView, gridColumns, gridOptions);

    updateRows =  function(updateData) {
        console.log(products);
        dataView.beginUpdate();
        dataView.setItems(products);
        dataView.endUpdate();

        grid.updateRowCount();

        if (updateData) {
            grid.setData(dataView, true);
        }

        grid.render();

    }

    updateRows(false);

    $("#add-product").click(function() {

        ean = $("#ean").val();
        qty = $("#qty").val();
        amt = $("#amt").val();
        disc = $("#disc").val();

        if (ean === '' || qty === '' || amt === '' || disc === '') 
        return;

        newProduct = {
            id: ean,
            ean: ean,
            qty: qty,
            amt: amt,
            disc: disc,
            net_amt: (amt - disc)
        }

        products.push(newProduct)

        updateRows(true);

        $("#ean").val('');
        $("#qty").val('');
        $("#amt").val('');
        $("#disc").val('');

    });

});

The aim of the page is take values from the input textboxes and put them in the grid as new entry. There seems to be something wrong with the script I have written though because no new rows are being created and the grid-canvas element canvas is as follows (no matter how manyelements i add to it).

<div class="grid-canvas" style="height: 35px; width: 400px;">
    <div class="ui-widget-content slick-row even" style="top:0px">
        <div class="slick-cell l0 r0 grid-cell">1</div>
        <div class="slick-cell l1 r1 grid-cell">1</div>
        <div class="slick-cell l2 r2 grid-cell"></div>
        <div class="slick-cell l3 r3 grid-cell">1</div>
        <div class="slick-cell l4 r4 grid-cell">0</div>
    </div>
</div>

I seem to have understood slickgrid’s implementation wrong. Could anyone direct me the right way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:25:06+00:00Added an answer on June 15, 2026 at 2:25 am

    I have solved the issue by adding the following style to my invoice-grid

    width:800px; height: 500px;
    

    I am not sure why styling is affecting addition of rows though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Testing out someone elses code, I noticed a few JSP pages printing funky non-ASCII
I'm testing out crossroads.js and hasher.js together and the following code errors on the
Im testing out some database compact code using a simple form to add data
I just started testing out Slickgrid for a project I'm working on and I'm
I'm testing out a code where I have 2 methods and a statement in
I'm testing out a simple sample PyGTK application based on the code in another
I'm testing out a bit of a code that I'm going to use for
I'm testing out somethings of Code Igniter and I noticed that code igniter doesn't
In testing out our API, one of our testers found out that when they
I'm testing out faults and exception handling on my service and am seeing odd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.