jQWidgets Forums

jQuery UI Widgets Forums Grid Serial number column

This topic contains 4 replies, has 3 voices, and was last updated by  Antony 12 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Serial number column #4168

    luyonglie
    Member

    how to create the Serial number cloumn
    like this
    No |firstname | lastname
    1 | |
    2 | |
    3 | |

    Serial number column #4182

    Peter Stoev
    Keymaster

    Hi luyonglie,

    To add a number column to the Grid, you can set the ‘columntype’ of a column to ‘number’.

    For example:

    $("#jqxGrid").jqxGrid(
    {
    source: dataAdapter,
    columns: [
    { text: 'No:', dataField: '', columntype: 'number', width: 100 },
    { text: 'First Name', dataField: 'firstname', width: 100 },
    { text: 'Last Name', dataField: 'lastname', width: 100 },
    { text: 'Product', dataField: 'productname', width: 180 },
    { text: 'Quantity', dataField: 'quantity', width: 80, cellsalign: 'right' },
    { text: 'Unit Price', dataField: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
    { text: 'Total', dataField: 'total', cellsalign: 'right', cellsformat: 'c2' }
    ]
    });

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Serial number column #5783

    Antony
    Member

    I tried columntype: ‘number’ and it works fine. But number starts from 0. Is there a way to make number start from 1 instead?

    Serial number column #5814

    Peter Stoev
    Keymaster

    Hi Antony,

    The behavior is built-in, but you can easily customize the rendering of any column by using a custom rendering function. For more information about the cells rendering, please take a look at this help topic: jquery-grid-cellsrendering.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Serial number column #5817

    Antony
    Member

    Thank you Steve. I got it working using cellsrenderer setting. However it would be more appreciated if you could have an inbuilt setting for this as serial number always starts with 1.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.