Constructor
new PaferaList(config)
Parameters:
Name | Type | Description |
---|---|---|
config |
object | With so many options, please see the source
to see what settings are available. The most commonly used ones are
|
- Source:
Methods
Add()
Called to add a new object. Normally just calls Edit() with a
blank object.
- Source:
ConfirmDelete(dbids)
Calls P.ConfirmDeletePopup() before actually deleting the items
from the database.
Note that this will delete *all* selected cards
Parameters:
Name | Type | Description |
---|---|---|
dbids |
list | The database IDs to be deleted |
- Source:
Delete(card, dbid)
Deletes the item from this widget and the database. Will show a
confirm delete popup for one chance to cancel with ConfirmDelete()
If multiple cards are selected, this function will delete all of them.
Parameters:
Name | Type | Description |
---|---|---|
card |
object | The object clicked |
dbid |
value | The database ID of the object |
- Source:
DeleteSelected()
Deletes every currently displayed card or table row.
- Source:
Display()
Displays the widget inside the div specified at construction and
setups all handlers.
- Source:
DisplayItems()
Called by List() to display the returned items from the server.
- Source:
(async) Edit(card, dbid)
Shows an P.EditPopup() to edit an existing object or add a new
object.
Parameters:
Name | Type | Description |
---|---|---|
card |
object | The object to change, or an empty object if adding a new object. |
dbid |
value | The database ID of the existing object, or a blank id if adding a new object. |
- Source:
GetEditFields(obj)
Returns the edit fields for use in P.EditPopup(). If you want to
have different fields for different objects, then override this
function.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The original object to edit |
- Source:
GetItemByID(dbid)
Returns the item in self.items that matches dbid.
Parameters:
Name | Type | Description |
---|---|---|
dbid |
value |
- Source:
GetItemDisplayName(obj)
Returns the displayed name of an item, which by default is its
first field. You may want to override this in a derived class
if you want to make the name more meaningful.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object |
- Source:
GetSelectedIDs()
Returns a list of all of the currently selected objects.
- Source:
(async) List(start)
Calls the server to get the list of items and displays them.
Parameters:
Name | Type | Description |
---|---|---|
start |
int | Leave undefined to use the last position, otherwise, specifies the starting position to display. |
- Source:
(async) LoadItem(dbid)
Loads all of the information for a particular object from the
database and returns it as a JavaScript object.
Parameters:
Name | Type | Description |
---|---|---|
dbid |
value | The database ID of the existing object. |
- Source:
(async) OnEditForm(obj)
Called after the editing form is displayed for custom fields.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The options passed to P.EditPopup() |
- Source:
OnFinished()
Called when the user clicks the finished button to signal that
all changes have been made. Derived classes should override this
for their own handling.
- Source:
OnItemClicked(card, dbid)
Handler for when a card is clicked. Derived classes should not
override this function, but the oncardclick(cardelement, dbid)
handler instad.
Parameters:
Name | Type | Description |
---|---|---|
card |
object | The object clicked |
dbid |
value | The database ID of the object |
- Source:
OnListParams()
Called before a list request is made to the server. Derived
classes can add their own data to be sent.
- Source:
(async) OnLoadItem(dbid)
Parameters:
Name | Type | Description |
---|---|---|
dbid |
value | The database ID of the existing object. |
- Source:
OnRenderItem(r)
Called to return the HTML inside of a card or tr element. By
default, it just loops through self.displayfields, but if you
want a nicer display, feel free to customize this in a derived
class.
Parameters:
Name | Type | Description |
---|---|---|
r |
object | The object to display |
- Source:
(async) OnSave(formdiv, data, resultsdiv, e, saveandcontinue)
Custom save handler if you don't have an apiurl. This function
should call await OnSaveComplete() and return true if it succeeds.
If it does not succeed, then it should return false.
Parameters:
Name | Type | Description |
---|---|---|
formdiv |
string | The selector for the whole form |
data |
object | The data to save to the server |
resultsdiv |
string | The div to display progress in |
e |
event | The event that trigged the save |
saveandcontinue |
bool | A flag indicating whether to return to the previous screen or to stay on this screen and allow further changes. |
- Source:
(async) OnSaveComplete(data, resultsdiv, saveandcontinue)
Called after an object has been saved with the returned data
from the server.
The normal behavior is to list new changes and remove the editing
layer, so make sure that if you override this function, your
own function must do the same.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | The data to save to the server |
resultsdiv |
string | The div to display progress in |
saveandcontinue |
bool | A flag indicating whether to return to the previous screen or to stay on this screen and allow further changes. |
- Source:
OnSaveData(obj)
Called before the changed object is sent to the server for last
minute data changes.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The data to send to the server |
- Source:
RenderItem(r)
Returns the full HTML for a card or table row, calling
OnRenderItem() to handle the inner portion.
Derived classes normally should not override this method since
this only takes care of the outer container and action buttons.
Instead, override OnRenderItem() to customize your display.
Parameters:
Name | Type | Description |
---|---|---|
r |
object | The object to display |
- Source:
SelectAll()
Selects every currently displayed card or table row.
- Source:
SelectNone()
Deelects every currently selected card or table row.
- Source:
ToggleTable()
Toggles between table and card displays.
- Source: