How to add an object to the datatable

How to add an object to the datatable

puraminypuraminy Posts: 11Questions: 0Answers: 0
edited November 2013 in General
I need an extra property for the table,
how can I add it so with the table object can access my defined object ?

Replies

  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    edited November 2013
    I found this solution

    $.fn.dataTableExt.aoGroups = [];
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I don't really understand I'm afraid. What are you doing with the extra static property on the dataTableExt object?

    Allan
  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    edited November 2013
    Simply I need an storage (memory) to keep some information about row groups.
    in a way I can manipulate and access it via the the table object.
    I don't want to call a function to recalculate it again and again.



    I don't know where to declare it.
    however the above code helped me.
    is there anything wrong?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    No - that is the correct place to put extensions to DataTables! Its just an unusual question and I was curious :-).

    Allan
  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    edited November 2013
    then please guide me.
    I found it cant be accessed outside the table.
    anyway

    Why it is unusual?
    if we have extension for functions, could we extend the table properties (fields, dynamic storages..)?
    I think its a simple straightforward question and should have a simple answer.

    Simply I want

    oTable.myVariable

    [Edit]
    Sorry, I didn't understand your answer because of my poor English, I thought you say No, dont do that...
    anyway finally I could access it via ...ext.myVariable
  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    it seems it can be accessed by

    oTable.DataTable.ext.aoGroups
  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    When I finished my plugin I will be offer it here, I hope its not repetitious, however I didn't find such thing anywhere.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Unusual just because nobody has asked that before - or at least not that I remember :-).

    I don't really understand what you mean by "I found it cant be accessed outside the table." - why not? Its a global parameter.

    > oTable.myVariable

    Can you not just assign it directly to the object? It would help if you should me what you were looking for in a test case.

    Allan
  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    I am new to javascript and jquery,
    I declared it as

    $.fn.dataTableExt.aoGroups = [];

    I can access it via

    oTable.DataTable.ext.aoGroups
    or
    just found
    oTable.dataTableExt.aoGroups


    maybe because of misspelled name I didn't realized the later one works too.
    if there is other methods I dont know
    -----
    by the way I hope to receive answer to my other discussions too
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Those methods all sound valid :-). I still am not sure what exactly you are using it for, so I can't say if that is the best way of doing it, or not.

    > by the way I hope to receive answer to my other discussions too

    I try to answer as many questions as possible, but I have only a limited amount of free time. If you require urgent help, there is a priority support option available: http://datatables.net/support .

    Allan
  • puraminypuraminy Posts: 11Questions: 0Answers: 0
    edited November 2013
    I have almost finished a plugin for row grouping but not the way you see in another plugin

    I simply loop through columns and find the groups then add them to a combobox as a filter box,

    this way you can view all the groups and easily multiple columns grouping is possible
    I will post it soon

    but forget these all.

    I have another urgent need. I posted it here

    I dog the web to find this again simple basic need. Why we cant filter based on input or select boxes within the cells? or any custom portion or tag.
    wish I could map cells value for filtering too.

    Please help me, I appreciate the time you put on members here, you are great

    http://datatables.net/forums/discussion/18164/filter-on-rows-with-input-or-combo-boxes#Item_1
This discussion has been closed.