Javascriptapi

From KFMdoc
Jump to: navigation, search

Here is an overview of the javascipt structure of KFM to which will ease the development of plugins, widgets and the KFM core. There are two javascript libraries included in KFM. Mootools and jQuery. The rest of the functions are for a large part special KFM functions.

Contents

mootools

Mootools JavaScript library. See for more information http://mootools.net/ It is advised not to use mootools tricks, since it will be deprecated in the future.

jQuery

The jQuery library is included in the nocompatible modes which results in the fact that the basic jQuery call is $j() in stead of the default $(). There are some jQuery plugins added to KFM which you can use. The current libraries are:

  • jQuery core version 1.2.2
  • impromptu a promt tool
  • tablesorter for sorting tables
  • dimensions
  • iutil
  • idrag
  • columnSizing

KFM display

kfm_prompt

kfm_prompt('Description','initial value of textbox',function(value){});

Displays a box with description as text, initial value in the textbox and the function is is executed when OK is pressed. The parameter value is the value present in the textbox.

kfm.showMessages

kfm.showMessages(['message1','message2']);

Function that shows messages that will disappear automatically after some time. Input parameter must be an array.

kfm.showErrors

kfm.showErrors([{message:'Error message error1'},{message:'Error message error2'}]);

This shows a KFM box of errors. Input parameter is an array of objects with message as the error message.

kfm_modal_open

kfm_modal_open('HTML content of KFM modal','modal title');

This opens a KFM modal box that displays HTML content.

Handy functions

kfm_inArray

kfm_inArray(needle, [haystack]);

checks if needle is in haystack which is an array. Returns true when needle is in haystack, false otherwise.

Personal tools